https://bugs.llvm.org/show_bug.cgi?id=47356
Bug ID: 47356
Summary: c++2a reports an error of overloaded operator while
c++11/17 accepts
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]
The following code is rejected by -std=c++2a, while ok with -std=c++11 or
-std=c++17.
$ cat s.cpp
template<typename T>
struct A {
A() {}
template<typename U>
A(const A<U>&) {}
bool operator==(const A&) const { return true; }
};
A<const int> a;
A<int> b;
auto c = (a == b);
$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
ab4627364aefcaac751e757b721b7d07b48a545a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang++ -c -std=c++17 s.cpp
success.
$ clang++ -c -std=c++2a s.cpp
s.cpp:13:13: error: use of overloaded operator '==' is ambiguous (with operand
types 'A<const int>' and 'A<int>')
auto c = (a == b);
~ ^ ~
s.cpp:8:8: note: candidate function
bool operator==(const A&) const { return true; }
^
s.cpp:8:8: note: candidate function (with reversed parameter order)
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