]> granicus.if.org Git - clang/commitdiff
Fix http://llvm.org/bugs/show_bug.cgi?id=2161.
authorSteve Naroff <snaroff@apple.com>
Wed, 19 Mar 2008 23:07:49 +0000 (23:07 +0000)
committerSteve Naroff <snaroff@apple.com>
Wed, 19 Mar 2008 23:07:49 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48568 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 84fe08198f95bf5ff95aba211763c581fbecfe53..02b5f31c874d0526d69ee71e106f2e61636baa4a 100644 (file)
@@ -1089,8 +1089,19 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
     // empty arg list, don't push any params.
   } else {
     for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
-      Params.push_back(ActOnParamDeclarator(D.getTypeObject(0).Fun.ArgInfo[i],
-                                            FnBodyScope));
+      ParmVarDecl *parmDecl;
+      
+      parmDecl = ActOnParamDeclarator(D.getTypeObject(0).Fun.ArgInfo[i],
+                                      FnBodyScope);
+      // C99 6.7.5.3p4: the parameters in a parameter type list in a function
+      // declarator that is part of a function definition of that function
+      // shall not have incomplete type.
+      if (parmDecl->getType()->isIncompleteType()) {
+        Diag(parmDecl->getLocation(), diag::err_typecheck_decl_incomplete_type,
+             parmDecl->getType().getAsString());
+        parmDecl->setInvalidDecl();
+      }
+      Params.push_back(parmDecl);
     }
   }