https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124404

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <[email protected]>:

https://gcc.gnu.org/g:eb908945226a63acfd215dac11b7f686f769636d

commit r16-7995-geb908945226a63acfd215dac11b7f686f769636d
Author: Jakub Jelinek <[email protected]>
Date:   Wed Mar 11 07:50:22 2026 +0100

    c++: Fix up __builtin_constexpr_diag for std::string operands [PR124404]

    __builtin_constexpr_diag works fine with string literals or class arguments
    like std::{,u8}string_view or string view like classes, but as the
following
    testcase shows doesn't work with std::string argument.
    I believe the important difference is that std::string has non-trivial
    destructor and so needs to be passed by invisible reference while
    std::string_view doesn't.

    Anyway, the following patch makes it work even with std::string.

    2026-03-11  Jakub Jelinek  <[email protected]>

            PR c++/124404
            * constexpr.cc (cxx_eval_constexpr_diag): Call
convert_from_reference
            on arguments.

            * g++.dg/ext/constexpr-diag7.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to