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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to