diff --git a/parse.yy b/parse.yy index 3eb4b2be..33e19dbc 100644 --- a/parse.yy +++ b/parse.yy @@ -1862,6 +1862,8 @@ function_definition const FunctionType *funcType = CastType($2->type); if (funcType == NULL) AssertPos(@1, m->errorCount > 0); + else if ($1->storageClass == SC_TYPEDEF) + Error(@1, "Illegal \"typedef\" provided with function definition."); else { Stmt *code = $4; if (code == NULL) code = new StmtList(@4); diff --git a/tests_errors/func-def-with-typedef.ispc b/tests_errors/func-def-with-typedef.ispc new file mode 100644 index 00000000..a750a9be --- /dev/null +++ b/tests_errors/func-def-with-typedef.ispc @@ -0,0 +1,4 @@ +// Illegal "typedef" provided with function definition + +typedef float foo(float a, float b) { } +