[all-commits] [llvm/llvm-project] 47747d: [clang] Handle templated operators with reversed a...
Utkarsh Saxena via All-commits
all-commits at lists.llvm.org
Fri Oct 20 05:40:38 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 47747da6340b00e301d3656f95ecf9b04a6ec2bb
https://github.com/llvm/llvm-project/commit/47747da6340b00e301d3656f95ecf9b04a6ec2bb
Author: Utkarsh Saxena <usaxena95 at gmail.com>
Date: 2023-10-20 (Fri, 20 Oct 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/SemaOverload.cpp
M clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
Log Message:
-----------
[clang] Handle templated operators with reversed arguments (#69595)
https://github.com/llvm/llvm-project/pull/68999 correctly computed
conversion sequence for reversed args to a template operators. This was
a breaking change as code, previously accepted in C++17, starts to break
in C++20.
Example:
```cpp
struct P {};
template<class S> bool operator==(const P&, const S &);
struct A : public P {};
struct B : public P {};
bool check(A a, B b) { return a == b; } // This is now ambiguous in C++20.
```
In order to minimise widespread breakages, as a clang extension, we had
previously accepted such ambiguities with a warning
(`-Wambiguous-reversed-operator`) for non-template operators. Due to the
same reasons, we extend this relaxation for template operators.
Fixes https://github.com/llvm/llvm-project/issues/53954
More information about the All-commits
mailing list