[PATCH] D83263: [WIP] Clang crashed while checking for deletion of copy and move ctors

Vy Nguyen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 19:02:52 PDT 2020


oontvoo updated this revision to Diff 275885.
oontvoo added a comment.

Dont skip checking even for templated type


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83263

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/trivial-abi-templated-type.cpp


Index: clang/test/SemaCXX/trivial-abi-templated-type.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/trivial-abi-templated-type.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// expected-no-diagnostics
+
+template <class>
+class __attribute__((trivial_abi)) a { a(a &&); };
Index: clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -9719,6 +9719,11 @@
 
   // Ill-formed if the copy and move constructors are deleted.
   auto HasNonDeletedCopyOrMoveConstructor = [&]() {
+    // If we know there exist users-defined move/copy ctors, don't try to infer
+    // the deletion of implicit ones becausee Sema may not have the info yet.
+    if (RD.hasUserDeclaredMoveConstructor() ||
+        RD.hasUserDeclaredCopyConstructor())
+      return true;
     if (RD.needsImplicitCopyConstructor() &&
         !RD.defaultedCopyConstructorIsDeleted())
       return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83263.275885.patch
Type: text/x-patch
Size: 1073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200707/cc060939/attachment.bin>


More information about the cfe-commits mailing list