Issue error if "typedef" is inadvertently included in function definition.
Issue #267.
This commit is contained in:
2
parse.yy
2
parse.yy
@@ -1862,6 +1862,8 @@ function_definition
|
|||||||
const FunctionType *funcType = CastType<FunctionType>($2->type);
|
const FunctionType *funcType = CastType<FunctionType>($2->type);
|
||||||
if (funcType == NULL)
|
if (funcType == NULL)
|
||||||
AssertPos(@1, m->errorCount > 0);
|
AssertPos(@1, m->errorCount > 0);
|
||||||
|
else if ($1->storageClass == SC_TYPEDEF)
|
||||||
|
Error(@1, "Illegal \"typedef\" provided with function definition.");
|
||||||
else {
|
else {
|
||||||
Stmt *code = $4;
|
Stmt *code = $4;
|
||||||
if (code == NULL) code = new StmtList(@4);
|
if (code == NULL) code = new StmtList(@4);
|
||||||
|
|||||||
4
tests_errors/func-def-with-typedef.ispc
Normal file
4
tests_errors/func-def-with-typedef.ispc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// Illegal "typedef" provided with function definition
|
||||||
|
|
||||||
|
typedef float foo(float a, float b) { }
|
||||||
|
|
||||||
Reference in New Issue
Block a user