aboutsummaryrefslogtreecommitdiff
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
commit5d59b79c2fd8783900e52cf2dd6add5d3627b2fc (patch)
tree798e332ed33e6b48cd2c6d50db88d158bc2ef5b6
parent0d62709c6e9b33dce788e0c0fa3cd5c7f4d637d0 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155575 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclCXX.cpp2
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 8645de1fcd..5267499ea4 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/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/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
index 3e9accfbf6..597e327a41 100644
--- a/test/CXX/special/class.copy/implicit-move.cpp
+++ b/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();
+}