November 26, 2019 [Issue 20417] New: __traits(compiles) returns false result if expression is not wrapped inside a lambda while typeof works correctly | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20417 Issue ID: 20417 Summary: __traits(compiles) returns false result if expression is not wrapped inside a lambda while typeof works correctly Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: sahmi.soulaimane@gmail.com Test case: ``` struct A { ~this(); } void f(A, int); A a(); int i(); pragma(msg, __traits(compiles, { f(a, i); })); // true pragma(msg, __traits(compiles, f(a, i))); // false pragma(msg, __traits(compiles, typeof({ f(a, i); }))); // true pragma(msg, __traits(compiles, typeof(f(a, i)))); // true ``` output: --- true false true true --- expected: --- true true true true --- -- |
Copyright © 1999-2021 by the D Language Foundation