forked from OSchip/llvm-project
Enforce C99 6.7.5.3p3, rejecting code like:
void foo(void (*q)(a,b,c)) {} llvm-svn: 39240
This commit is contained in:
parent
969ca15b41
commit
0d89d5a638
|
@ -133,6 +133,11 @@ TypeRef Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
|
|||
if (!FTI.hasPrototype) {
|
||||
// Simple void foo(), where the incoming T is the result type.
|
||||
T = Context.getFunctionTypeNoProto(T);
|
||||
|
||||
// C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function definition.
|
||||
if (FTI.NumArgs != 0)
|
||||
Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);
|
||||
|
||||
} else {
|
||||
// Otherwise, we have a function with an argument list that is
|
||||
// potentially variadic.
|
||||
|
|
|
@ -133,6 +133,11 @@ TypeRef Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
|
|||
if (!FTI.hasPrototype) {
|
||||
// Simple void foo(), where the incoming T is the result type.
|
||||
T = Context.getFunctionTypeNoProto(T);
|
||||
|
||||
// C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function definition.
|
||||
if (FTI.NumArgs != 0)
|
||||
Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);
|
||||
|
||||
} else {
|
||||
// Otherwise, we have a function with an argument list that is
|
||||
// potentially variadic.
|
||||
|
|
Loading…
Reference in New Issue