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

--- Comment #5 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:40485378ade83102d7aa30c317f5d6c90c1d232b

commit r14-8832-g40485378ade83102d7aa30c317f5d6c90c1d232b
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Feb 6 22:34:55 2024 +0100

    c++: Disallow this specifier except for parameter declarations [PR113788]

    The deducing this patchset added parsing of this specifier to
    cp_parser_decl_specifier_seq unconditionally, but in the C++ grammar
    this[opt] only appears in the parameter-declaration non-terminal, so
    rather than checking in all the callers of cp_parser_decl_specifier_seq
    except for cp_parser_parameter_declaration that this specifier didn't
    appear I think it is far easier and closer to what the standard says
    to only parse this specifier when called from
    cp_parser_parameter_declaration.

    2024-02-06  Jakub Jelinek  <ja...@redhat.com>

            PR c++/113788
            * parser.cc (CP_PARSER_FLAGS_PARAMETER): New enumerator.
            (cp_parser_decl_specifier_seq): Parse RID_THIS only if
            CP_PARSER_FLAGS_PARAMETER is set in flags.
            (cp_parser_parameter_declaration): Or in CP_PARSER_FLAGS_PARAMETER
            when calling cp_parser_decl_specifier_seq.

            * g++.dg/parse/pr113788.C: New test.

Reply via email to