www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14818] New: Unhelpful "does not match template overload set"

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

          Issue ID: 14818
           Summary: Unhelpful "does not match template overload set" error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Following incorrect program:

template Foo(T) if (is(T == int)) {}
template Bar(T) if (is(T == double)) {}

template Mix1() { alias X = Foo; }
template Mix2() { alias X = Bar; }
mixin Mix1;
mixin Mix2;
// in here, X is an OverloadSet

void main()
{
    // Neither Foo nor Bar match
    alias x = X!string;    // line 13
}

Reports:

test.d(13): Error: template instance test.X!string does not match template
overload set Bar

The diagnostic is not helpful. It should be:

test.d(13): Error: template instance test.X!string does not match template
overload set X

--
Jul 21 2015