2 problems I can't get my head around
John Chapman
johnch_atms at hotmail.com
Mon Nov 26 05:32:37 PST 2012
On Monday, 26 November 2012 at 12:32:08 UTC, Manu wrote:
> 1.
>
> enum i = 10;
> pragma(msg, is(i == enum) || is(typeof(i) == enum)); // <-
> false?!
>
> I can't find a way to identify that i is an enum, not a
> variable; can not
> be assigned, has no address, etc.
Because 'i' is not an enum, it's actually a manifest constant.
Unless you specify an enum name, no new type is created.
http://dlang.org/enum.html
Compare:
enum E {
i = 10
}
pragma(msg, is(typeof(E.i) == enum));
More information about the Digitalmars-d
mailing list