Skip to content

Fix ClassDB iterators making unintended copies #1774

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

BenLubar
Copy link
Contributor

godot-cpp/src/core/class_db.cpp: In static member function 'static void godot::ClassDB::_editor_get_classes_used_callback(GDExtensionTypePtr)':
godot-cpp/src/core/class_db.cpp:395:88: error: loop variable 'pair' of type 'const std::pair<godot::StringName, const GDExtensionInstanceBindingCallbacks*>&' binds to a temporary constructed from type 'std::pair<const godot::StringName, const GDExtensionInstanceBindingCallbacks*>' [-Werror=range-loop-construct]
  395 | ame, const GDExtensionInstanceBindingCallbacks *> &pair : instance_binding_callbacks) {
      |                                                    ^~~~

godot-cpp/src/core/class_db.cpp:395:88: note: use non-reference type 'const std::pair<godot::StringName, const GDExtensionInstanceBindingCallbacks*>' to make the copy explicit or 'const std::pair<const godot::StringName, const GDExtensionInstanceBindingCallbacks*>&' to prevent copying

@BenLubar BenLubar requested a review from a team as a code owner April 21, 2025 23:47
@dsnopek dsnopek added the bug This has been identified as a bug label Apr 29, 2025
@dsnopek dsnopek added this to the 4.x milestone Apr 29, 2025
Copy link
Collaborator

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

This error started happening on our CI as well, and this PR fixes it :-)

@dsnopek dsnopek merged commit 543c1f7 into godotengine:master Apr 29, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug cherrypick:4.3 cherrypick:4.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants