[PATCH] D129591: Modify CXXMethodDecl::isMoveAssignmentOperator() to look through type sugar

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 14 16:10:08 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG80dec2ecfffe: [Clang] Modify CXXMethodDecl::isMoveAssignmentOperator() to look through type… (authored by shafik).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129591/new/

https://reviews.llvm.org/D129591

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/AST/DeclCXX.cpp
  clang/test/SemaCXX/cxx0x-defaulted-functions.cpp


Index: clang/test/SemaCXX/cxx0x-defaulted-functions.cpp
===================================================================
--- clang/test/SemaCXX/cxx0x-defaulted-functions.cpp
+++ clang/test/SemaCXX/cxx0x-defaulted-functions.cpp
@@ -259,3 +259,28 @@
 
   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;
+};
+}
Index: clang/lib/AST/DeclCXX.cpp
===================================================================
--- clang/lib/AST/DeclCXX.cpp
+++ clang/lib/AST/DeclCXX.cpp
@@ -2410,7 +2410,7 @@
     return false;
 
   QualType ParamType = getParamDecl(0)->getType();
-  if (!isa<RValueReferenceType>(ParamType))
+  if (!ParamType->isRValueReferenceType())
     return false;
   ParamType = ParamType->getPointeeType();
 
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -186,6 +186,8 @@
 - 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
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129591.444827.patch
Type: text/x-patch
Size: 1849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220714/c8732548/attachment-0001.bin>


More information about the cfe-commits mailing list