Skip to content

Internal error with boolean helper

Yaaaa, I'm regularly blundering into this error and now got around to reproducing it on a small example.

This code

{$mode objfpc} {$modeswitch typehelpers}
type
	BoolHelper = type helper for boolean
		function ToChar: char;
	end;

	function BoolHelper.ToChar: char;
	begin
		result := pChar('-+')[ord(self)];
	end;

var
	x: uint32;

begin
	writeln((@x = @x).ToChar);
end.

spews out an ‘Internal error 2011010304’ instead of compiling.

Edited by Rika
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information