forked from OSchip/llvm-project
[Clang] Modify CXXMethodDecl::isMoveAssignmentOperator() to look through type sugar
AcceptedPublic Currently CXXMethodDecl::isMoveAssignmentOperator() does not look though type sugar and so if the parameter is a type alias it will not be able to detect that the method is a move assignment operator. This PR fixes that and adds a set of tests that covers that we correctly detect special member functions when defaulting or deleting them. This fixes: https://github.com/llvm/llvm-project/issues/56456 Differential Revision: https://reviews.llvm.org/D129591
This commit is contained in:
parent
9913ea490a
commit
80dec2ecff
|
@ -186,6 +186,8 @@ Bug Fixes
|
|||
- Clang now checks ODR violations when merging concepts from different modules.
|
||||
Note that this may possibly break existing code, and is done so intentionally.
|
||||
Fixes `Issue 56310 <https://github.com/llvm/llvm-project/issues/56310>`_.
|
||||
- Clang will now look through type sugar when checking a member function is a
|
||||
move assignment operator. Fixes `Issue 56456 <https://github.com/llvm/llvm-project/issues/56456>`_.
|
||||
|
||||
Improvements to Clang's diagnostics
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -2410,7 +2410,7 @@ bool CXXMethodDecl::isMoveAssignmentOperator() const {
|
|||
return false;
|
||||
|
||||
QualType ParamType = getParamDecl(0)->getType();
|
||||
if (!isa<RValueReferenceType>(ParamType))
|
||||
if (!ParamType->isRValueReferenceType())
|
||||
return false;
|
||||
ParamType = ParamType->getPointeeType();
|
||||
|
||||
|
|
|
@ -259,3 +259,28 @@ namespace P1286R2 {
|
|||
|
||||
static_assert(noexcept(A::B()), "");
|
||||
}
|
||||
|
||||
namespace GH56456 {
|
||||
template <typename T>
|
||||
using RC=T const&;
|
||||
template <typename T>
|
||||
using RV=T&;
|
||||
template <typename T>
|
||||
using RM=T&&;
|
||||
|
||||
struct A {
|
||||
A(RC<A>) = default;
|
||||
A(RM<A>) = default;
|
||||
|
||||
auto operator=(RC<A>) -> RV<A> = default;
|
||||
auto operator=(RM<A>) -> RV<A> = default;
|
||||
};
|
||||
|
||||
struct B {
|
||||
B (RC<B>) = delete;
|
||||
B (RM<B>) = delete;
|
||||
|
||||
auto operator = (RC<B>) -> RV<B> = delete;
|
||||
auto operator = (RM<B>) -> RV<B> = delete;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue