summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-04-25 18:28:49 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-04-25 18:28:49 +0000
commit1ad04d95bccb9cc80bcdfd148b29efb59c6d38d7 (patch)
tree7107f450dbd027c9c0907087135c387a14204f2a
parent2823f58038d69ccf37f546bbeebc42fa9fad8924 (diff)
downloadbcm5719-llvm-1ad04d95bccb9cc80bcdfd148b29efb59c6d38d7.tar.gz
bcm5719-llvm-1ad04d95bccb9cc80bcdfd148b29efb59c6d38d7.zip
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. llvm-svn: 155575
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp2
-rw-r--r--clang/test/CXX/special/class.copy/implicit-move.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 8645de1fcd6..5267499ea4e 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -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))
diff --git a/clang/test/CXX/special/class.copy/implicit-move.cpp b/clang/test/CXX/special/class.copy/implicit-move.cpp
index 3e9accfbf6a..597e327a414 100644
--- a/clang/test/CXX/special/class.copy/implicit-move.cpp
+++ b/clang/test/CXX/special/class.copy/implicit-move.cpp
@@ -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();
+}
OpenPOWER on IntegriCloud