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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to