]> granicus.if.org Git - clang/commitdiff
PR12625: Cope with classes which have incomplete base or member types:
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 25 Apr 2012 18:28:49 +0000 (18:28 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 25 Apr 2012 18:28:49 +0000 (18:28 +0000)
Don't try to query whether an incomplete type has a trivial copy constructor
when determining whether a move constructor should be declared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155575 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/CXX/special/class.copy/implicit-move.cpp

index 8645de1fcd62e3ec1bad55109df1f355e1f668e4..5267499ea4eac46130b6fb94e14778d28b288285 100644 (file)
@@ -8165,7 +8165,7 @@ hasMoveOrIsTriviallyCopyable(Sema &S, QualType Type, bool IsConstructor) {
   // reference types, are supposed to return false here, but that appears
   // to be a standard defect.
   CXXRecordDecl *ClassDecl = Type->getAsCXXRecordDecl();
-  if (!ClassDecl)
+  if (!ClassDecl || !ClassDecl->getDefinition())
     return true;
 
   if (Type.isTriviallyCopyableType(S.Context))
index 3e9accfbf6a7231883d6be8c2cacd643059304ad..597e327a414d81760e129b14d5f05df105683255 100644 (file)
@@ -234,3 +234,10 @@ namespace DR1402 {
     friend NoMove11 &NoMove11::operator=(NoMove11 &&); // expected-error {{no matching function}}
   };
 }
+
+namespace PR12625 {
+  struct X; // expected-note {{forward decl}}
+  struct Y {
+    X x; // expected-error {{incomplete}}
+  } y = Y();
+}