Delphi TypeInfo for generic records -


i'm trying use generic records rtti, ran problem type info. know why following won't compile using delphi 2010?

program generictypeinfo;  {$apptype console}  uses   typinfo,   sysutils;  type    tmyrec<t> = record   public     value: t;   end;    tmyint = tmyrec<integer>;   tmystring = tmyrec<string>;  begin    try     writeln(gettypename(typeinfo(tmyrec<integer>)));     <--- works fine     writeln(gettypename(typeinfo(tmyrec<string>)));      <---       writeln(gettypename(typeinfo(tmyint)));              <--- won't compile     writeln(gettypename(typeinfo(tmystring)));           <---   nor this!!   except     on e: exception       writeln(e.classname, ': ', e.message);   end;    readln;  end. 

the lines indicated above generate following compiler errors:

[dcc error] generictypeinfo.dpr(24): e2134 type 'tmyint' has no type info [dcc error] generictypeinfo.dpr(24): e2134 type 'tmystring' has no type info 

i can't what's big difference between 2? admit i'm not low-level expert, why compiler treat differently? need work tmyint , tmystring types.

thanks help.

this bug in delphi 2010 has been fixed xe , higher.

but there workaround.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -