Issue error if "typedef" is inadvertently included in function definition.

Issue #267.
This commit is contained in:
Matt Pharr
2012-05-25 11:09:08 -07:00
parent 64807dfb3b
commit 38cea6dc71
2 changed files with 6 additions and 0 deletions

View File

@@ -1862,6 +1862,8 @@ function_definition
const FunctionType *funcType = CastType<FunctionType>($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);

View File

@@ -0,0 +1,4 @@
// Illegal "typedef" provided with function definition
typedef float foo(float a, float b) { }