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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (functionType->isExported || overloadType->isExported)
|
// Check for a redeclaration of a function with the same name
|
||||||
Error(pos, "Illegal to have \"export\" function with same name "
|
// and type. This also hits when we have previously declared
|
||||||
"as previously declared function (%s:%d).",
|
// the function and are about to define it.
|
||||||
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))
|
if (Type::Equal(overloadFunc->type, functionType))
|
||||||
return;
|
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
|
// If all of the parameter types match but the return type is
|
||||||
// different, return an error--overloading by return type isn't
|
// different, return an error--overloading by return type isn't
|
||||||
// allowed.
|
// 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() { }
|
export void foo() { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user