[dox] enum specs vs reality
Jacob Carlborg
doob at me.com
Wed Aug 28 11:44:03 PDT 2013
On 2013-08-28 17:34, captaindet wrote:
>> The last one will fail since "typeof" expects an expression and not a
>> type.
>
> a) so are you saying
>
> enum WhatAmI;
>
> is legal? (just asking because i don't know)
Yes, it's sometimes usable to be able to declare dummy types like this.
Especially now when we have UAD's (User Defined Attribute):
enum foo;
@foo bar ();
> b) what typeof expects/tolerates seems to be a bit of a minefield by
> itself.
>
> enum test = true;
> writeln( typeof(test).stringof ); //prints: bool
>
> enum wtf;
> writeln( typeof(wtf).stringof ); //Error: argument wtf to typeof is
> not an expression
That seems strange. Perhaps worth a bugzilla report:
http://d.puremagic.com/issues/
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list