================ @@ -37,6 +37,25 @@ These changes are ones which we think may surprise users when upgrading to Clang |release| because of the opportunity they pose for disruption to existing code bases. +- Fix a bug in reversed argument for templated operators. + This breaks code in C++20 which was previously accepted in C++17. Eg: + + .. code-block:: cpp + + struct P {}; + template<class S> bool operator==(const P&, const S&); + + struct A : public P {}; + struct B : public P {}; + + bool ambiguous(A a, B b) { return a == b; } // This equality is now ambiguous in C++20. + + template<class S> bool operator!=(const P&, const S&); + bool fine(A a, B b) { return a == b; } // Ok. Found a matching operator!=. + + To reduce widespread breakages, as an extension, clang would accept this with a + ``-Wambiguous-reversed-operator`` warning. ---------------- ilya-biryukov wrote:
NIT: it reads as if it is a new warning, I suggest saying "Clang accepts this code with an existing warning -W...." https://github.com/llvm/llvm-project/pull/69595 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits