Issue 19409 - static if (__traits(compiles, __traits(identifier, ...))) evaluates to false even though the expression alone evaluates to true
Summary: static if (__traits(compiles, __traits(identifier, ...))) evaluates to false ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-18 10:38 UTC by JR
Modified: 2018-11-22 16:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description JR 2018-11-18 10:38:40 UTC
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() {}
Comment 1 RazvanN 2018-11-22 12:26:27 UTC
PR: https://github.com/dlang/dmd/pull/8993
Comment 2 github-bugzilla 2018-11-22 16:05:07 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/97cc21405837738fbcf4f4180ed639d09109b228
Issue 19409 - static if (__traits(compiles, __traits(identifier, ...))) evaluates to false even though the expression alone evaluates to true

https://github.com/dlang/dmd/commit/804342b741edbaed53597f2ddac5e45c2f0d7fbc
Merge pull request #8993 from RazvanN7/Issue_19409

Fix Issue 19409 - static if (__traits(compiles, __traits(identifier, ...) )) evaluates to false even though the expression alone evaluates to true
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>