From f2725633d775ef21c3e2cffc2cbf14cdc83e8ca2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 4 Mar 2021 17:57:00 +0200 Subject: [PATCH] Check for function declaration conflicting with something else Functions are allowed to have multiple declarations but only one definition. --- source/glsl/validate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index 5fd4ebca..f3390048 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -95,6 +95,10 @@ void DeclarationValidator::visit(InterfaceBlock &iface) void DeclarationValidator::visit(FunctionDeclaration &func) { + if(Statement *previous = find_definition(func.name)) + if(!dynamic_cast(previous)) + multiple_definition(format("'%s'", func.name), func, *previous); + if(func.definition==&func) check_definition(func.name, func); TraversingVisitor::visit(func); -- 2.45.2