From dc6f90acd804f3269540c6448bd108128d1d6ffe Mon Sep 17 00:00:00 2001 From: Chaosus Date: Thu, 8 Aug 2024 11:23:27 +0300 Subject: [PATCH] Forbid function declaration with a const qualifier in shaders --- servers/rendering/shader_language.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 0235d72cfa0..3247c6d9924 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -9640,6 +9640,11 @@ Error ShaderLanguage::_parse_shader(const HashMap &p_f break; } + if (is_constant) { + _set_error(vformat(RTR("'%s' qualifier cannot be used with a function return type."), "const")); + return ERR_PARSE_ERROR; + } + FunctionInfo builtins; if (p_functions.has(name)) { builtins = p_functions[name];