[clang] a3a0f59 - Revert "Correctly compute conversion seq for args to fn with reversed param order (#68999)"
Dmitry Chernenkov via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 18 07:15:23 PDT 2023
Author: Dmitry Chernenkov
Date: 2023-10-18T14:13:48Z
New Revision: a3a0f59a1e1cb0ac02f06b19f730ea05a6541c96
URL: https://github.com/llvm/llvm-project/commit/a3a0f59a1e1cb0ac02f06b19f730ea05a6541c96
DIFF: https://github.com/llvm/llvm-project/commit/a3a0f59a1e1cb0ac02f06b19f730ea05a6541c96.diff
LOG: Revert "Correctly compute conversion seq for args to fn with reversed param order (#68999)"
This reverts commit e6d0b126c824222fca2f31a2ba571c2ee2bb4760.
See PR for reason
https://github.com/llvm/llvm-project/pull/68999#issuecomment-1768541660
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaOverload.cpp
clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 443325bb0d1e17d..81cbfd90155fe0b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -117,8 +117,6 @@ C++ Language Changes
C++20 Feature Support
^^^^^^^^^^^^^^^^^^^^^
-- Fix a bug in conversion sequence of arguments to a function with reversed parameter order.
- Fixes `GH <https://github.com/llvm/llvm-project/issues/53954>`_.
C++23 Feature Support
^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index c271cebb9eb638f..ce78994e6553814 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -7688,7 +7688,7 @@ bool Sema::CheckNonDependentConversions(
QualType ParamType = ParamTypes[I + Offset];
if (!ParamType->isDependentType()) {
unsigned ConvIdx = PO == OverloadCandidateParamOrder::Reversed
- ? Args.size() - 1 - (ThisConversions + I)
+ ? 0
: (ThisConversions + I);
Conversions[ConvIdx]
= TryCopyInitialization(*this, Args[I], ParamType,
diff --git a/clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp b/clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
index 02fe37dc1be5058..5c6804eb7726b5f 100644
--- a/clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
+++ b/clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
@@ -324,41 +324,6 @@ bool x = X() == X(); // expected-warning {{ambiguous}}
}
} // namespace P2468R2
-namespace GH53954{
-namespace test1 {
-struct P {
- template <class T>
- friend bool operator==(const P&, const T&); // expected-note {{candidate}} \
- // expected-note {{reversed parameter order}}
-};
-struct A : public P {};
-struct B : public P {};
-bool check(A a, B b) { return a == b; } // expected-error {{ '==' is ambiguous}}
-}
-
-namespace test2 {
-struct P {
- template <class T>
- friend bool operator==(const T&, const P&); // expected-note {{candidate}} \
- // expected-note {{reversed parameter order}}
-};
-struct A : public P {};
-struct B : public P {};
-bool check(A a, B b) { return a == b; } // expected-error {{ '==' is ambiguous}}
-}
-
-namespace test3 {
-struct P {
- template<class S>
- bool operator==(const S &) const; // expected-note {{candidate}} \
- // expected-note {{reversed parameter order}}
-};
-struct A : public P {};
-struct B : public P {};
-bool check(A a, B b) { return a == b; } // expected-error {{ '==' is ambiguous}}
-}
-}
-
#else // NO_ERRORS
namespace problem_cases {
More information about the cfe-commits
mailing list