diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-06-03 09:37:11 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-06-03 09:37:11 -0400 |
commit | 69f517ac20566a645ff41a9bfca535822205a538 (patch) | |
tree | 2875107dbf5de313799318d11e5d0f1c1f3da5f7 /gcc/tree-data-ref.c | |
parent | 7ed1cd9665d8ca0fa07b2483e604c25e704584af (diff) | |
download | gcc-69f517ac20566a645ff41a9bfca535822205a538.zip gcc-69f517ac20566a645ff41a9bfca535822205a538.tar.gz gcc-69f517ac20566a645ff41a9bfca535822205a538.tar.bz2 |
c++: using-enum and access specifiers [PR100862]
When copying the enumerators imported by a class-scope using-enum
declaration, we need to override current_access_specifier so that
finish_member_declaration gives the copies the same access as the
using-enum decl. (A class-scope using-enum is processed late, so
current_access_specifier at this point is otherwise set to the last
access specifier within the class.) To that end, this patch makes
handle_using_decl call set_current_access_from_decl accordingly.
For consistency, this patch makes build_enumerator use
set_current_access_from_decl too.
PR c++/100862
gcc/cp/ChangeLog:
* pt.c (set_current_access_from_decl): Move to ...
* class.c (set_current_access_from_decl): ... here.
(handle_using_decl): Use it to propagate the access of the
using-enum decl to the copy of the imported enumerator.
* cp-tree.h (set_current_access_from_decl): Declare.
* decl.c (build_enumerator): Simplify using make_temp_override
and set_current_access_from_decl.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/using-enum-9.C: New test.
Diffstat (limited to 'gcc/tree-data-ref.c')
0 files changed, 0 insertions, 0 deletions