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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <[email protected]>:

https://gcc.gnu.org/g:1fd2dbf360d9eac76e1f2d34db987d6b29786da6

commit r16-8590-g1fd2dbf360d9eac76e1f2d34db987d6b29786da6
Author: Marek Polacek <[email protected]>
Date:   Thu Apr 9 19:52:15 2026 -0400

    c++/reflection: fn call with splice in decltype rejected [PR124835]

    Here we reject the valid

      decltype([:^^foo<int>:](42))

    saying that a ')' is expected.  [dcl.type.decltype] says "if E is an
    unparenthesized splice-expression, decltype(E) is..." and we handle it
    by calling _splice_expression and setting id_expression_or_member_access_p.

    But for the code above we shouldn't do this, because the [: :] isn't
    the sole operand of decltype.  _nth_token_starts_splice_without_nns_p
    checks that there's no :: after the :] but here we want to check that
    the [: :] is followed by a ')'.

            PR c++/124835

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_decltype_expr): Check that [: :] is
            followed by a close paren before declaring it an unparenthesized
            splice-expression.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/decltype2.C: New test.

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

Reply via email to