Fix rdar://5921025 a crash on the included testcase.
llvm-svn: 50885
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 373727a..9a7d692 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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());
diff --git a/clang/test/Sema/struct-packed-align.c b/clang/test/Sema/struct-packed-align.c
index f718343..f759e37 100644
--- a/clang/test/Sema/struct-packed-align.c
+++ b/clang/test/Sema/struct-packed-align.c
@@ -62,3 +62,10 @@
extern int g1[sizeof(struct as3) == 16 ? 1 : -1];
extern int g2[__alignof(struct as3) == 8 ? 1 : -1];
+
+
+// rdar://5921025
+struct packedtest {
+ int ted_likes_cheese;
+ void *args[] __attribute__((packed));
+};