The following fails to compile in Delphi 2010. Does anyone happen to know if this work in XE3 or not?
The following fails to compile in Delphi 2010. Does anyone happen to know if this work in XE3 or not?
type
TMyParam = record
end;
TFoo = type TMyParam; // <-- error
[DCC Error] E2086 Type 'TMyParam' is not yet completely defined
type
TMyParam
end;
TFoo = type TMyParam
[DCC Error] E2086 Type 'TMyParam
No, not even in XE4 and since XE it raises the correct compiler error: E2574 Instantiated type can not be used for TYPE'd type declaration
ReplyDeleteStefan Glienke Thanks for the quick reply. That's pretty shitty though. Do you know the reason?
ReplyDeleteInterestingly enough it works fine if I first alias the type:
ReplyDeletetype
TMyParam = record
end;
TStringMyParam = TMyParam; // alias
// need new type block here, otherwise incomplete type error
type
TFoo = type TStringMyParam; // use aliased type, not direct type
If I then get the type name of TFoo I get TMyParam.
I guess that's why it works then, it creates an alias instead of an actual type. Gah Delphi...
ReplyDeleteFull code: http://delphi.nopaste.dk/p43509