diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index fc35678e657..f9cd7d81154 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -6965,6 +6965,17 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat if (error_set) return DataType(); + // Special case: check copy constructor. Those are defined implicitly in Variant. + if (par_types.size() == 1) { + if (!par_types[0].has_type || (par_types[0].kind == DataType::BUILTIN && par_types[0].builtin_type == tn->vtype)) { + DataType result; + result.has_type = true; + result.kind = DataType::BUILTIN; + result.builtin_type = tn->vtype; + return result; + } + } + bool match = false; List constructors; Variant::get_constructor_list(tn->vtype, &constructors);