]> granicus.if.org Git - clang/commitdiff
Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.
authorSerge Pavlov <sepavloff@gmail.com>
Tue, 2 Jul 2013 17:31:56 +0000 (17:31 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Tue, 2 Jul 2013 17:31:56 +0000 (17:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185446 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/CodeGen/PR15826.c [new file with mode: 0644]

index 2d40f152b1032b33b849eceb79604f147054f600..8e863896521b7d2b07730c64fc7843fedf6de645 100644 (file)
@@ -10483,7 +10483,8 @@ void Sema::ActOnTagFinishDefinition(Scope *S, Decl *TagD,
     Tag->setTopLevelDeclInObjCContainer();
 
   // Notify the consumer that we've defined a tag.
-  Consumer.HandleTagDeclDefinition(Tag);
+  if (!Tag->isInvalidDecl())
+    Consumer.HandleTagDeclDefinition(Tag);
 }
 
 void Sema::ActOnObjCContainerFinishDefinition() {
diff --git a/test/CodeGen/PR15826.c b/test/CodeGen/PR15826.c
new file mode 100644 (file)
index 0000000..e002c3e
--- /dev/null
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -verify -emit-llvm %s
+
+/* Testcase for PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout */
+struct sysctl_req {
+  struct aiocblist *p_aio;
+};
+
+struct sysctl_oid {
+  int (*oid_handler)(struct sysctl_req *req);
+};
+
+static struct sysctl_oid sysctl___kern_features_aio;
+
+static void const *const __set_sysctl_set_sym_sysctl___kern_features_aio
+    __attribute__((__used__)) = &sysctl___kern_features_aio;
+
+struct aiocblist {
+  struct aiocb uaiocb; // expected-error {{field has incomplete type}} expected-note {{forward declaration}}
+};