bug in typeof or wrong enum specs?

Rainer Schuetze r.sagitario at gmx.de
Wed Aug 28 23:52:28 PDT 2013



On 29.08.2013 01:28, captaindet wrote:
> a recent discussion (
> http://forum.dlang.org/thread/kvje4r$1tff$1@digitalmars.com ) about the
> official enum dox ( http://dlang.org/enum.html ) was not conclusive whether
>
>      enum IDENTIFIER;
>
> is officially allowed/supported. jacob pointed out that it has an
> important use case in that it can serve as UDA. as UDAs are fairly new,
> this cannot be the reason why this syntax was allowed in the first place
> though, *if* it is allowed. also, it might be used in meta stuff similar
> to "#define IDENTIFIER" in C - playing with this idea i run into this
> issue...

enum IDENTIFIER;

was used to help resolving forward references to type IDENTIFIER when 
the resolving of forward references was a lot less capable than it is 
now. I don't think it is still needed for that. The same syntax exists 
for struct or class.

Please also note that using it as in C/C++ to declare a type that is 
actually defined in another module does not work. The type is bound to 
the current module and the definition has to be in that module.


More information about the Digitalmars-d mailing list