Skip to content

Commit

Permalink
Revert "Correctly compute conversion seq for args to fn with reversed…
Browse files Browse the repository at this point in the history
… param order (#68999)"

This reverts commit e6d0b12.

See PR for reason

#68999 (comment)
  • Loading branch information
steelannelida committed Oct 18, 2023
1 parent cf1bde9 commit a3a0f59
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
2 changes: 0 additions & 2 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a3a0f59

Please sign in to comment.