Don't issue error incorrectly with forward decl. of exported function.
Issue #281.
This commit is contained in:
16
module.cpp
16
module.cpp
@@ -634,16 +634,18 @@ Module::AddFunctionDeclaration(const std::string &name,
|
||||
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
|
||||
// Check for a redeclaration of a function with the same name
|
||||
// and type. This also hits when we have previously declared
|
||||
// the function and are about to define it.
|
||||
if (Type::Equal(overloadFunc->type, functionType))
|
||||
return;
|
||||
|
||||
if (functionType->isExported || overloadType->isExported)
|
||||
Error(pos, "Illegal to provide \"export\" qualifier for "
|
||||
"functions with the same name but different types. "
|
||||
"(Previous function declaration (%s:%d).)",
|
||||
overloadFunc->pos.name, overloadFunc->pos.first_line);
|
||||
|
||||
// If all of the parameter types match but the return type is
|
||||
// different, return an error--overloading by return type isn't
|
||||
// allowed.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Illegal to have "export" function with same name as previously declared function
|
||||
// Illegal to provide "export" qualifier for functions with the same name but different types
|
||||
|
||||
export void foo() { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user