Reproducible in: master (61598c5c88), 4.3, possibly all the way back to 3.3.
The code of interest was introduced in commit 221f5da85 on 2021-08-15.
I apologize for not including an MRP, but this is a bug in a method exported via the gdextension API and I do not believe the bug can be reproduced with GDScript, C#, or godot-cpp because none of them ever call the method in question. I am working on SwiftGodot (Swift language bindings for Godot).
System information
macOS 14.7.1 - Godot 4.3 or master (61598c5c88)
Issue description
In variant_op.h lives the class OperatorEvaluatorModNZ which implements the % operator, and at line 301 begins the specialization for the class for Vector2i % Vector2i:
Line 320 needs to be changed to also use operator %.
Steps to reproduce
Write new language bindings that use the engine to compute Vector2i % Vector2i.
In my case, I am writing test cases that compare what the engine returns and what my native Swift code computes, to verify that my Swift code matches the engine behavior. Imagine my surprise when the engine gave the wrong answer!
Minimal reproduction project (MRP)
I don't think it's feasible to include an MRP. Reproducing the problem requires creating new language bindings, because none of GDScript, C#, and godot-cpp rely on this exported engine method.
Tested versions
The code of interest was introduced in commit 221f5da85 on 2021-08-15.
I apologize for not including an MRP, but this is a bug in a method exported via the gdextension API and I do not believe the bug can be reproduced with GDScript, C#, or godot-cpp because none of them ever call the method in question. I am working on SwiftGodot (Swift language bindings for Godot).
System information
macOS 14.7.1 - Godot 4.3 or master (61598c5c88)
Issue description
In
variant_op.h
lives the classOperatorEvaluatorModNZ
which implements the%
operator, and at line 301 begins the specialization for the class forVector2i % Vector2i
:https://github.com/godotengine/godot/blob/f952bfe9985ad8f507cc29b2c7601bbba18b8039/core/variant/variant_op.h#L301-L323
At line 312 it uses the overloaded C++ operator
%
operator on behalf of GDScript:https://github.com/godotengine/godot/blob/f952bfe9985ad8f507cc29b2c7601bbba18b8039/core/variant/variant_op.h#L312
At line 317 it again uses the overloaded C++
%
for gdextensions calling through theVariant
API:https://github.com/godotengine/godot/blob/f952bfe9985ad8f507cc29b2c7601bbba18b8039/core/variant/variant_op.h#L317
But at line 320, it incorrectly uses the overloaded C++ operator
/
for gdextensions calling through the pointer API:https://github.com/godotengine/godot/blob/f952bfe9985ad8f507cc29b2c7601bbba18b8039/core/variant/variant_op.h#L320
Line 320 needs to be changed to also use operator
%
.Steps to reproduce
Write new language bindings that use the engine to compute
Vector2i % Vector2i
.In my case, I am writing test cases that compare what the engine returns and what my native Swift code computes, to verify that my Swift code matches the engine behavior. Imagine my surprise when the engine gave the wrong answer!
Minimal reproduction project (MRP)
I don't think it's feasible to include an MRP. Reproducing the problem requires creating new language bindings, because none of GDScript, C#, and godot-cpp rely on this exported engine method.