Inline scoped enums bug?
Inline scoped enums bug?
As a nested type in a class you cannot access A:
type
TC = class
public
type TBar = set of (A, B, C);
end;
Neither A, nor TBar.A, nor TC.TBar.A works in Delphi 10.2.
As a nested type in a class you cannot access A:
type
TC = class
public
type TBar = set of (A, B, C);
end;
Neither A, nor TBar.A, nor TC.TBar.A works in Delphi 10.2.
Works fine here in 10.2.3:
ReplyDeleteprogram Project135;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TC = class
public
type TBar = set of (A, B, C);
end;
var
x: TC.TBar;
begin
x := [A];
end.
I can, do you have a mcve?
ReplyDeleteThat is not a type declaration?
ReplyDeleteHow about this style of declaration?
type
TC = class
public type
TBar = (A, B, C) ;
TBarSet = set of TBar;
end;
...
var
tb: TC.TBarSet;
begin
tb := [TC.TBar.A, TC.TBar.B];
I think it’s fairly safe to answer any question with the title like “is this a compiler bug?” with “no. pebkac”, without reading the actual question. :-)
ReplyDeleteCompiling that under {$SCOPEDENUMS ON} makes little sense to me, since you're requesting the A, B and C identifiers to be scoped to something anonymous, and therefore, that you inherently can't qualify with. Ergo, an inability to actually reference A, B C is arguably technically correct....
ReplyDelete