www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18194] New: hasStaticMember doesn't work with static enum

https://issues.dlang.org/show_bug.cgi?id=18194

          Issue ID: 18194
           Summary: hasStaticMember doesn't work with static enum
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Steps to reproduce:

class X
{
    static int a;
    static enum b;
}

static assert(hasStaticMember!(X, "a"));
static assert(hasStaticMember!(X, "b"));

What should happen:

Both asserts should pass.

What happens:

The second assert fails.


The error occurs because enum hasStaticMember(T, string member) =
__traits(compiles, &sym);, and enums don't have an address.

--
Jan 05