Bug 19409 – static if (__traits(compiles, __traits(identifier, ...))) evaluates to false even though the expression alone evaluates to true

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-11-18T10:38:40Z
Last change time
2018-11-22T16:05:08Z
Assigned to
No Owner
Creator
JR

Comments

Comment #0 by zorael — 2018-11-18T10:38:40Z
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 by razvan.nitu1305 — 2018-11-22T12:26:27Z
Comment #2 by github-bugzilla — 2018-11-22T16:05:07Z
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 <[email protected]>