www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21451] New: __traits(compiles, ...) is wrong on overloaded

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

          Issue ID: 21451
           Summary: __traits(compiles, ...) is wrong on overloaded
                    templates instantiated with empty parens
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: qs.il.paperinik gmail.com

Since 2.064, the assert with // ??? succeeds. 
From 2.060 to 2.063, the respective assert fails as expected.
void f(int a : 1)() { } void f(int b : 2)(int x) { } void main() { static assert( __traits(compiles, f!1 )); static assert( __traits(compiles, f!1() )); static assert( __traits(compiles, f!2(2) )); static assert(!__traits(compiles, f!(1, 2) )); static assert( __traits(compiles, f!() )); // ??? static assert(!__traits(compiles, { f!(); })); } The marked assert shouldn't compile. --
Dec 03 2020