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

          Issue ID: 14375
           Summary: static assert leads to __traits(allMembers) retuning
                    an extra empty entry
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nob...@puremagic.com
          Reporter: pro.mathias.l...@gmail.com

This confuses MemberFunctionsTuple alot:
/usr/include/dlang/dmd/std/traits.d(3647): Error: string expected as second
argument of __traits hasMember instead of ""

Tested with GDC (2.065), LDC (2.066.1) and 2.067

````
class IKeysAPI(string greetings) {
        static assert(greetings == "Hello world", greetings);
}

void main() {
        foreach (method; __traits(allMembers, IKeysAPI!("Hello world"))) {
                static assert (method.length, "Empty string from the compiler
??");
                pragma(msg, method);
        }
}
````

Commenting the static assert makes the foreach pass.

--

Reply via email to