[fpc-pascal] Scoped enums and inferred types

Ryan Joseph ryan at thealchemistguild.com
Wed Feb 21 03:38:17 CET 2018

I just learned FPC has scoped enums, which is nice, but they lack what you could call “relative inference” based on the type being passed. In the example below the parameter “t” is TMyType but passing “A” doesn’t work. Doesn’t the compiler know the type and can infer “A” is relative to the scoped enum? I understand there’s a possibility for name conflicts but you could just use the full name in that case.

Is this a missing feature or do you need to enable it or something?

{$scopedenums on}
	TMyType = (A, B, C);
{$scopedenums off}

procedure DoThis (t: TMyType);


	Ryan Joseph

More information about the fpc-pascal mailing list