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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:12b0d35ec52375da5652d2b8da74083ab700b9d7

commit r13-5037-g12b0d35ec52375da5652d2b8da74083ab700b9d7
Author: Patrick Palka <ppa...@redhat.com>
Date:   Thu Jan 5 14:21:34 2023 -0500

    c++: class-head parsing and CPP_TEMPLATE_ID access [PR108275]

    When tentatively parsing what is really an elaborated-type-specifier
    containing a template-id first as a class-specifier, we may form a
    CPP_TEMPLATE_ID token that later gets reused by the fallback parse if
    the tentative parse fails.  These special tokens also capture the access
    checks that have been deferred while parsing the template-id.  But here
    we form such a token when the access check state is dk_no_check, and so
    the token captures no access checks.  This effectively bypasses access
    checking for the template-id during the subsequent parse as an
    elaborated-type-specifier.

    This patch fixes this by using dk_deferred instead of dk_no_check when
    parsing the class name of a class-head.

            PR c++/108275

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_class_head): Use dk_deferred instead of
            dk_no_check when parsing the class name.

    gcc/testsuite/ChangeLog:

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

Reply via email to