[llvm-bugs] [Bug 49964] New: [concepts] ambiguous overload accepted as valid
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 14 17:45:50 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49964
Bug ID: 49964
Summary: [concepts] ambiguous overload accepted as valid
Product: clang
Version: 11.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: ldalessandro at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Clang accepts the following concept code that gcc considers ambiguous (reduced
testcase due to Patrick Palka).
```
template <class T> concept C1 = true;
template <class T> concept C2 = C1<T> && true;
template <C1 T, C1 U> int f(T, U);
template <C1 T, C2 U> int f(U, T);
int x = f(0, 0); // expect error: ambiguous call
```
Live: https://godbolt.org/z/6K93d1Ye4
I originally submitted this as a gcc bug
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99963) but Patrick and Jason
Merrill determined that gcc's behavior is correct.
According to their reading of the standard (I don't have the background to make
this statement), this call to f should be ambiguous because the matching
between the template argument index and function argument index is different in
its two declarations.
--
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/20210415/7210bb85/attachment.html>
More information about the llvm-bugs
mailing list