www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21576] New: __traits(compile) does not automatically infer to


          Issue ID: 21576
           Summary: __traits(compile) does not automatically infer to
                    empty parameter template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jlourenco5691 gmail.com

import std;

void foo(TRange ...)(TRange range)
        foreach(r; range) bar(r);

void foo(TRange ...)()
        foreach(T; TRange) bar!T;

void bar(T)(T t = T.init)
    if (!is(T == string))

void main()
    assert(!__traits(compiles, foo(1, "")));           // ok
    assert(!__traits(compiles, foo!(uint, string)())); // ok
    assert(!__traits(compiles, foo!(uint, string)));   // fails

Jan 23