c++: Private parent access check for using decls [PR19377]
commitbe246ac2d26e1cb072f205bf97d5eac150220f3f
authorAnthony Sharp <anthonysharp15@gmail.com>
Wed, 10 Mar 2021 20:36:03 +0000 (10 20:36 +0000)
committerJason Merrill <jason@redhat.com>
Wed, 17 Mar 2021 23:11:02 +0000 (17 19:11 -0400)
tree346b3e5f33583fc9fcbfb848de10fe0284e0d47c
parent5074c6fa38cef1abb9a355d717b41441a44c4e6a
c++: Private parent access check for using decls [PR19377]

This bug was already mostly fixed by the patch for PR17314. This
patch continues that by ensuring that where a using decl is used,
causing an access failure to a child class because the using decl is
private, the compiler correctly points to the using decl as the
source of the problem.

gcc/cp/ChangeLog:

2021-03-10  Anthony Sharp  <anthonysharp15@gmail.com>

* semantics.c (get_class_access_diagnostic_decl): New
function that examines special cases when a parent
class causes a private access failure.
(enforce_access): Slightly modified to call function
above.

gcc/testsuite/ChangeLog:

2021-03-10  Anthony Sharp  <anthonysharp15@gmail.com>

* g++.dg/cpp1z/using9.C: New using decl test.

Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp1z/using9.C [new file with mode: 0644]