[cfe-commits] r155575 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/special/class.copy/implicit-move.cpp

Richard Smith richard-llvm at metafoo.co.uk
Wed Apr 25 11:28:49 PDT 2012


Author: rsmith
Date: Wed Apr 25 13:28:49 2012
New Revision: 155575

URL: http://llvm.org/viewvc/llvm-project?rev=155575&view=rev
Log:
PR12625: Cope with classes which have incomplete base or member types:
Don't try to query whether an incomplete type has a trivial copy constructor
when determining whether a move constructor should be declared.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/CXX/special/class.copy/implicit-move.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=155575&r1=155574&r2=155575&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Apr 25 13:28:49 2012
@@ -8165,7 +8165,7 @@
   // 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))

Modified: cfe/trunk/test/CXX/special/class.copy/implicit-move.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/implicit-move.cpp?rev=155575&r1=155574&r2=155575&view=diff
==============================================================================
--- cfe/trunk/test/CXX/special/class.copy/implicit-move.cpp (original)
+++ cfe/trunk/test/CXX/special/class.copy/implicit-move.cpp Wed Apr 25 13:28:49 2012
@@ -234,3 +234,10 @@
     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();
+}





More information about the cfe-commits mailing list