Issue error on overloaded "export"ed functions.

Issue #270.
This commit is contained in:
Matt Pharr
2012-05-25 10:28:01 -07:00
parent fd03ba7586
commit d943455e10
2 changed files with 17 additions and 0 deletions

View File

@@ -613,6 +613,18 @@ Module::AddFunctionDeclaration(const std::string &name,
for (unsigned int i = 0; i < overloadFuncs.size(); ++i) {
Symbol *overloadFunc = overloadFuncs[i];
const FunctionType *overloadType =
CastType<FunctionType>(overloadFunc->type);
if (overloadType == NULL) {
Assert(m->errorCount == 0);
continue;
}
if (functionType->isExported || overloadType->isExported)
Error(pos, "Illegal to have \"export\" function with same name "
"as previously declared function (%s:%d).",
overloadFunc->pos.name, overloadFunc->pos.first_line);
// Check for a redeclaration of a function with the same
// name and type
if (Type::Equal(overloadFunc->type, functionType))

View File

@@ -0,0 +1,5 @@
// Illegal to have "export" function with same name as previously declared function
export void foo() { }
export void foo(uniform int x) { }