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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:38a13ea4117b96e467f78b3f86d737ecbe326935

commit r15-6760-g38a13ea4117b96e467f78b3f86d737ecbe326935
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Jan 10 10:32:36 2025 +0100

    c++: Fix up ICEs on constexpr inline asm strings in templates [PR118277]

    The following patch fixes ICEs when the new inline asm syntax
    to use C++26 static_assert-like constant expressions in place
    of string literals is used in templates.
    As finish_asm_stmt doesn't do any checking for
    processing_template_decl, this patch also just defers handling
    those strings in templates rather than say trying fold_non_dependent_expr
    and if the result is non-dependent and usable, try to extract.

    The patch also reverts changes to cp_parser_asm_specification_opt
    which allowed something like
    void foo () asm ((std::string_view ("bar")));
    but it would be really hard to support
    template <int N>
    void baz () asm ((std::string_view ("qux")));
    (especially with dependent constant expression).

    And the patch adds extensive test coverage for the various errors.

    2025-01-10  Jakub Jelinek  <ja...@redhat.com>

            PR c++/118277
            * cp-tree.h (finish_asm_string_expression): Declare.
            * semantics.cc (finish_asm_string_expression): New function.
            (finish_asm_stmt): Use it.
            * parser.cc (cp_parser_asm_string_expression): Likewise.
            Wrap string into PAREN_EXPR in the ("") case.
            (cp_parser_asm_definition): Don't ICE if finish_asm_stmt
            returns error_mark_node.
            (cp_parser_asm_specification_opt): Revert 2024-06-24 changes.
            * pt.cc (tsubst_stmt): Don't ICE if finish_asm_stmt returns
            error_mark_node.

            * g++.dg/cpp1z/constexpr-asm-4.C: New test.
            * g++.dg/cpp1z/constexpr-asm-5.C: New test.

Reply via email to