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
This commit is contained in:
Richard Smith 2012-04-25 18:28:49 +00:00
parent 2823f58038
commit 1ad04d95bc
2 changed files with 8 additions and 1 deletions

View 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))

View 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();
}