diff options
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 15 |
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); } } |