void DeclarationValidator::visit(FunctionDeclaration &func)
{
if(Statement *previous = find_definition(func.name))
- if(!dynamic_cast<FunctionDeclaration *>(previous))
+ {
+ FunctionDeclaration *prev_func = dynamic_cast<FunctionDeclaration *>(previous);
+ if(prev_func && prev_func->definition==&func)
+ declarations[current_block][func.name] = &func;
+ else
multiple_definition(format("'%s'", func.name), func, *previous);
+ }
+ else
+ record_definition(func.name, func);
- if(func.definition==&func)
- check_definition(func.name, func);
TraversingVisitor::visit(func);
}
{
vec2 texcoord;
} vs_out;
+vec3 normal();
vec3 normal;
out VertexOut2
{
}
/* Expected error:
-<test>:11: Multiple definition of 'normal'
+<test>:8: Multiple definition of 'normal'
<test>:7: Previous definition is here
-<test>:13: Multiple definition of 'texcoord'
-<test>:10: Previous definition is here
-<test>:19: Multiple definition of 'texcoord'
-<test>:10: Previous definition is here
+<test>:12: Multiple definition of 'normal'
+<test>:7: Previous definition is here
+<test>:14: Multiple definition of 'texcoord'
+<test>:11: Previous definition is here
+<test>:20: Multiple definition of 'texcoord'
+<test>:11: Previous definition is here
*/