Skip to content

Linux/GCC 13 build fix for template specialization of pasteTextWithLinebreaks #2729

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
Sep 28, 2024

Conversation

Nicky-D
Copy link
Contributor

@Nicky-D Nicky-D commented Sep 27, 2024

GCC 13 did not like having a template<> inside the class body at all.
Thus turn the specialization of pasteTextWithLinebreaks into a class methode pasteTextWithLinebreaksImpl.

all.
Thus turn the specialization of pasteTextWithLinebreaks into a
class methode pasteTextWithLinebreaksImpl.
@Ansariel
Copy link
Contributor

Ansariel commented Sep 27, 2024

Another GCC bug. This construct should be allowed as per C++17. GCC bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282

@@ -313,10 +313,9 @@ class LLTextEditor :
template <typename STRINGTYPE>
void pasteTextWithLinebreaks(const STRINGTYPE& clean_string)
{
pasteTextWithLinebreaks<LLWString>(ll_convert(clean_string));
pasteTextWithLinebreaksImpl(ll_convert(clean_string));
Copy link
Contributor

@Ansariel Ansariel Sep 27, 2024

Choose a reason for hiding this comment

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

What about

    void            pasteTextWithLinebreaks(const STRINGTYPE& clean_string)
    {
        if constexpr (std::is_same_v<LLWString, STRINGTYPE>)
            pasteTextWithLinebreaksImpl(clean_string);
        else
            pasteTextWithLinebreaksImpl(ll_convert(clean_string));
    }

to prevent an unnecessary ll_convert if not needed?

Copy link
Contributor

@marchcat marchcat left a comment

Choose a reason for hiding this comment

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

Thank you!

@marchcat marchcat merged commit d511ff7 into secondlife:develop Sep 28, 2024
12 checks passed
@marchcat marchcat added this to the Develop milestone Sep 28, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2024
@Nicky-D Nicky-D deleted the gcc13-template-fix branch September 30, 2024 14:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants