A field of incomplete type is sufficiently disruptive that we should mark
the record invalid.
llvm-svn: 111211
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index cc6e2fa..b7b802a 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5955,8 +5955,11 @@
QualType EltTy = Context.getBaseElementType(T);
if (!EltTy->isDependentType() &&
- RequireCompleteType(Loc, EltTy, diag::err_field_incomplete))
+ RequireCompleteType(Loc, EltTy, diag::err_field_incomplete)) {
+ // Fields of incomplete type force their record to be invalid.
+ Record->setInvalidDecl();
InvalidDecl = true;
+ }
// C99 6.7.2.1p8: A member of a structure or union may have any type other
// than a variably modified type.