Fix rdar://5921025 a crash on the included testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50885 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 373727a..9a7d692 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2183,7 +2183,8 @@
else if (FieldDecl *FD = dyn_cast<FieldDecl>(d)) {
// If the alignment is less than or equal to 8 bits, the packed attribute
// has no effect.
- if (Context.getTypeAlign(FD->getType()) <= 8)
+ if (!FD->getType()->isIncompleteType() &&
+ Context.getTypeAlign(FD->getType()) <= 8)
Diag(rawAttr->getLoc(),
diag::warn_attribute_ignored_for_field_of_type,
rawAttr->getName()->getName(), FD->getType().getAsString());