[Bug c++/82613] Cannot access private definitions in base clause of friend class template
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 20 14:55:24 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82613
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:79e1251b642db038df276153c9f2ec6b82e56162
commit r11-6815-g79e1251b642db038df276153c9f2ec6b82e56162
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Jan 20 09:43:48 2021 -0500
c++: Defer access checking when processing bases [PR82613]
When parsing the base-clause of a class declaration, we need to defer
access checking until the entire base-clause has been seen, so that
access can be properly checked relative to the scope of the class with
all its bases attached. This allows us to accept the declaration of
struct D from Example 2 of [class.access.general] (access12.C below).
Similarly when substituting into the base-clause of a class template,
which is the subject of PR82613.
gcc/cp/ChangeLog:
PR c++/82613
* parser.c (cp_parser_class_head): Defer access checking when
parsing the base-clause until all bases are seen and attached
to the class type.
* pt.c (instantiate_class_template): Likewise when substituting
into dependent bases.
gcc/testsuite/ChangeLog:
PR c++/82613
* g++.dg/parse/access12.C: New test.
* g++.dg/template/access35.C: New test.
More information about the Gcc-bugs
mailing list