[Issue 19409] New: static if (__traits(compiles, __traits(identifier, ...))) evaluates to false even though the expression alone evaluates to true

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 18 10:38:40 UTC 2018


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

          Issue ID: 19409
           Summary: static if (__traits(compiles, __traits(identifier,
                    ...))) evaluates to false even though the expression
                    alone evaluates to true
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: zorael at gmail.com

Manjaro/Arch x86_64, dmd v2.083, ldc 1.12.0, gdc 8.2.1/2.081.2.

https://run.dlang.io/is/4wfH1q

Running it on run.dlang.io with all dmd compilers seems to suggest it's a
2.071.x regression.

---

module test.foo;

pragma(msg, __traits(identifier, test.foo)); // "foo"

pragma(msg, __traits(compiles, __traits(identifier, test.foo))); // true

static assert(__traits(compiles, __traits(identifier, test.foo))); // passes

static if (__traits(compiles,  __traits(identifier, test.foo))) // fails
{
    pragma(msg, "Never gets here");
}
else
{
    static assert(0);
}

void main() {}

--


More information about the Digitalmars-d-bugs mailing list