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

Declare explicit specializations for CharStringT #1265

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

mihe
Copy link
Contributor

@mihe mihe commented Oct 12, 2023

Related to #1150.

I'm in the process of upgrading godot-cpp from 1009da4 to 3b3f357, and when compiling with clang-cl (and maybe regular Clang as well?) I seem to end up with the following compilation error:

src/variant/char_string.cpp(95,32): error: explicit specialization of 'get_data' after instantiation
const char *CharStringT<char>::get_data() const {
                               ^
include/godot_cpp/core/type_info.hpp(354,1): note: implicit instantiation first required here
MAKE_TYPED_ARRAY_INFO(bool, Variant::BOOL)
^
include/godot_cpp/core/type_info.hpp(342,128): note: expanded from macro 'MAKE_TYPED_ARRAY_INFO'
                        return make_property_info(Variant::Type::ARRAY, "", PROPERTY_HINT_ARRAY_TYPE, Variant::get_type_name(m_variant_type).utf8().get_data()); \
                                                                                                                                                    ^

From what I can tell it seems like it gets cranky over the fact that the specializations made for CharStringT::get_data() weren't declared first. Searching around a bit seems to support that this should be required, although the example shown there is a bit different.

Weirdly enough it compiles just fine with latest MSVC. I haven't tried GCC, but I assume CI would have caught that already.

Anyway, this PR fixes this by simply declaring the specializations.

@mihe mihe requested a review from a team as a code owner October 12, 2023 14:12
@dsnopek dsnopek added the bug This has been identified as a bug label Oct 12, 2023
@dsnopek dsnopek added this to the 4.x milestone Oct 12, 2023
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 makes sense to me

@dsnopek dsnopek merged commit 292a50d into godotengine:master Oct 12, 2023
12 checks passed
@mihe mihe deleted the char-string-specializations branch October 12, 2023 15:49
@dsnopek
Copy link
Collaborator

dsnopek commented Oct 23, 2023

Cherry-picked for 4.1 in PR #1281

@akien-mga akien-mga modified the milestones: 4.x, 4.2 Oct 24, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants