void ReferenceValidator::visit(FunctionCall &call)
{
- if(!call.declaration && !call.constructor)
+ if((!call.constructor && !call.declaration) || (call.constructor && !call.type))
{
- map<string, FunctionDeclaration *>::iterator i = stage->functions.lower_bound(call.name);
- if(i!=stage->functions.end() && i->second->name==call.name)
+ bool have_declaration = call.constructor;
+ if(!call.constructor)
+ {
+ map<string, FunctionDeclaration *>::iterator i = stage->functions.lower_bound(call.name);
+ have_declaration = (i!=stage->functions.end() && i->second->name==call.name);
+ }
+
+ if(have_declaration)
{
bool valid_types = true;
string signature;
}
if(valid_types)
- error(call, format("No matching overload found for call to '%s(%s)'", call.name, signature));
+ error(call, format("No matching %s found for '%s(%s)'", (call.constructor ? "constructor" : "overload"), call.name, signature));
}
else
error(call, format("Call to undeclared function '%s'", call.name));