Fix SemaTemplate/instantiate-field.cpp after r261297.
authorNico Weber <nicolasweber@gmx.de>
Fri, 19 Feb 2016 02:51:07 +0000 (02:51 +0000)
committerNico Weber <nicolasweber@gmx.de>
Fri, 19 Feb 2016 02:51:07 +0000 (02:51 +0000)
For templates, fields can have incomplete types:

  template <class T>
  struct A2 {
    struct B;
    B b;
  };

Don't try to touch the DefinitionData of those fields.

llvm-svn: 261301

clang/lib/AST/DeclCXX.cpp

index c8edd5a1b4fa0067a3494723d13ccb8fc1b4b4f5..e84b91388fb780a406d46fc39938e3bda5b8c340 100644 (file)
@@ -704,7 +704,7 @@ void CXXRecordDecl::addedMember(Decl *D) {
 
     if (!Field->hasInClassInitializer() && !Field->isMutable()) {
       if (CXXRecordDecl *FieldType = Field->getType()->getAsCXXRecordDecl()) {
-        if (!FieldType->allowConstDefaultInit())
+        if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
           data().HasUninitializedFields = true;
       } else {
         data().HasUninitializedFields = true;