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

Comments

  1. 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

    ReplyDelete
  2. Stefan Glienke Thanks for the quick reply. That's pretty shitty though. Do you know the reason?

    ReplyDelete
  3. Interestingly enough it works fine if I first alias the type:

    type
      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.

    ReplyDelete
  4. I guess that's why it works then, it creates an alias instead of an actual type. Gah Delphi...

    Full code: http://delphi.nopaste.dk/p43509

    ReplyDelete

Post a Comment