Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling varargs methods without arguments causes a validated call failure #1641

Closed
Ivorforce opened this issue Nov 16, 2024 · 2 comments · Fixed by godotengine/godot#99403
Closed

Comments

@Ivorforce
Copy link
Member

Ivorforce commented Nov 16, 2024

Godot version

4.3

godot-cpp version

4.3 (56571dc)

System information

macOS

Issue description

When calling a varargs method without arguments, you get a failure:

5 • 0:00:00:0653 main.gd:73 @ _ready): Vararg methods don't have validated call support. This is most likely an engine bug.

Varargs calls are not supposed to be validated, so it's probably wrong that it tries to validated-call it in the first place: https://github.com/godotengine/godot/blob/5efd124ca10bf46df62fa2441d80589777e54a5a/modules/gdscript/gdscript_compiler.cpp#L237

This may have to do with the fact that MethodBind.hint_flags is never set (neither to vararg static, nor to p_flags) - but then again, I think it's supposed to be determined automatically? I'm not sure, I don't know the source code well enough to provide a quick fix.

I don't think this issue occurs in upstream godot, but I haven't extensively checked.

Steps to reproduce

  1. Add and bind varargs function
  2. Call from GDScript without args

Minimal reproduction project

git clone https://github.com/Ivorforce/godot-cpp.git --branch no-arg-varargs

(or just add as remote / checkout branch)

https://github.com/Ivorforce/godot-cpp/tree/no-arg-varargs

@fwsGonzo
Copy link

I've had the same problem, and worked around it by making the all function parameters a single varargs

@dsnopek
Copy link
Collaborator

dsnopek commented Nov 18, 2024

Thanks!

Looks like this is caused by a fairly silly bug in Godot. I just posted PR godotengine/godot#99403 which fixes this in my testing. Please let me know if it works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants