From: Mikko Rasa Date: Sun, 28 Nov 2021 23:02:54 +0000 (+0200) Subject: Apply implicit conversions to function arguments X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=33e2d239d0e473a585243de9d9db36e49edf184b;p=libs%2Fgl.git Apply implicit conversions to function arguments --- diff --git a/source/glsl/resolve.cpp b/source/glsl/resolve.cpp index 3aeab30b..fbe60d79 100644 --- a/source/glsl/resolve.cpp +++ b/source/glsl/resolve.cpp @@ -1084,7 +1084,24 @@ void ExpressionResolver::visit(FunctionCall &call) TraversingVisitor::visit(call); if(call.declaration) + { + for(unsigned i=0; itype; + TypeDeclaration *param_type = call.declaration->parameters[i]->type_declaration; + BasicTypeDeclaration *arg_basic = dynamic_cast(arg_type); + BasicTypeDeclaration *param_basic = dynamic_cast(param_type); + if(arg_basic && param_basic) + { + Compatibility compat = get_compatibility(*param_basic, *arg_basic); + if(compat==RIGHT_CONVERTIBLE) + convert_to(call.arguments[i], *param_basic); + } + else if(!arg_type || !param_type || arg_type!=param_type) + return; + } resolve(call, call.declaration->return_type_declaration, false); + } else if(call.constructor) visit_constructor(call); }