Fix http://llvm.org/bugs/show_bug.cgi?id=1988.

Sema::CheckInitializerListTypes() needs to ignore invalid structures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index b81f3fe..c6f1203 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -526,6 +526,11 @@
         ++startIndex;
       } else {
         RecordDecl* structDecl = DeclType->getAsRecordType()->getDecl();
+        
+        // If the record is invalid, it's members can't be trusted. 
+        if (structDecl->isInvalidDecl())
+          return true;
+          
         // If structDecl is a forward declaration, this loop won't do anything;
         // That's okay, because an error should get printed out elsewhere. It
         // might be worthwhile to skip over the rest of the initializer, though.