[Issue 14375] New: static assert leads to __traits(allMembers) retuning an extra empty entry
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Mar 29 14:47:11 PDT 2015
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: nobody at puremagic.com
Reporter: pro.mathias.lang at 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.
--
More information about the Digitalmars-d-bugs
mailing list