[Issue 21752] New: Template constraint breaks overload resolution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 23 23:44:28 UTC 2021


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 at puremagic.com
          Reporter: moonlightsentinel at 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.

--


More information about the Digitalmars-d-bugs mailing list