[llvm-bugs] [Bug 44661] New: Failure to partially order constrained overload set of three parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 24 23:31:01 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44661

            Bug ID: 44661
           Summary: Failure to partially order constrained overload set of
                    three parameters
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Given the following code:

```
template<typename>
concept c1 = true;

template<typename, typename>
concept c2 = true;

template<
        c1 T1,
        c2<int> T2,
        c1 T3
>
int f(T1, T2, T3);

template<
        c1 T1,
        c2<int> T2,
        typename T3
>
int f(T1, T2, T3);

auto x = f(1, 2, 3);
```

Compiled with `clang++ -std=c++2a -o /dev/null -c main.cpp`

The expected behavior is to call the first overload. It is exactly as
constrained for the first two parameters for both overloads, but the first
overload has a constrained third parameter but the second overload has an
unconstrained third parameter. Instead, clang outputs:

```
main.cpp:21:10: error: call to 'f' is ambiguous
auto x = f(1, 2, 3);
         ^
main.cpp:12:5: note: candidate function [with T1 = int, T2 = int, T3 = int]
int f(T1, T2, T3);
    ^
main.cpp:19:5: note: candidate function [with T1 = int, T2 = int, T3 = int]
int f(T1, T2, T3);
    ^
1 error generated.
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200125/a320f6e6/attachment.html>


More information about the llvm-bugs mailing list