www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21752] New: Template constraint breaks overload resolution

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

          Issue ID: 21752
           Summary: Template constraint breaks overload resolution
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

A template constraint for a nested template breaks overload resolution in the
following example (even though the constraint is satisfied). Commenting the
constraint or moving it into a `static assert` fixes the problem.

------------------------------------------------------------
void foo(A)(A a)
{}

template foo()
{
    void foo()()
    if (true)  // Comment this constraint to make it pass
    {}
}

void main()
{
    foo!()();
}
------------------------------------------------------------

The original code used nested templates to create two variadic parameters but
those are not required to trigger this bug.

--
Mar 23