aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-03-19 23:07:49 +0000
committerSteve Naroff <snaroff@apple.com>2008-03-19 23:07:49 +0000
commit657aefe011bea7bda36771c07bd5cd8f82a82112 (patch)
tree8148ec110ec2d86d7db7d0a7a5a0abd5fa5a3d04
parenteeacc5203ae1defadbe647b3b22b0432e23f4393 (diff)
Fix http://llvm.org/bugs/show_bug.cgi?id=2161.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48568 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 84fe08198f..02b5f31c87 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -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);
}
}