www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14756] New: cannot deduce function with template constraint


          Issue ID: 14756
           Summary: cannot deduce function with template constraint
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tim.dlang t-online.de

The following code compiled with dmd v2.067, but results in an error for dmd

// copied from std.traits
enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...);

struct Test(size_t id)
    static void from(Other)(Other other) if(isInstanceOf!(Test, Other))

void main()
    Test!(1) test;

Here is the error message:
test.d(14): Error: template test.Test!2u.Test.from cannot deduce function from
argument types !()(Test!1u), candidates are:
test.d(6):        test.Test!2u.Test.from(Other)(Other other) if
(isInstanceOf!(Test, Other))

If the template constraint uses the is-expression directly, the error goes

Jul 01 2015