diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-06-07 12:02:08 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-06-07 12:02:08 -0400 |
commit | 6cb35b606c39d5f21f3298c77bfbcaaef3fbc872 (patch) | |
tree | d32e70dfba2570fb65379116c64fe0d6b37f16cf /gcc/bitmap.h | |
parent | 5e2e15f212e2458a1258b8c856895c755460bc6b (diff) | |
download | gcc-6cb35b606c39d5f21f3298c77bfbcaaef3fbc872.zip gcc-6cb35b606c39d5f21f3298c77bfbcaaef3fbc872.tar.gz gcc-6cb35b606c39d5f21f3298c77bfbcaaef3fbc872.tar.bz2 |
c++: access of dtor named by qualified template-id [PR100918]
Here, when resolving the destructor named by Inner<int>::~Inner<int>
(which is valid until C++20) we end up in cp_parser_lookup_name called
indirectly from cp_parser_template_id to look up the name Inner from
the scope Inner<int>. The lookup naturally finds the injected-class-name,
and because the flag is_template is true, we adjust this lookup result
to the TEMPLATE_DECL Inner. We then check access of this adjusted
lookup result. But this access check fails because the lookup scope is
Inner<int> and the context_for_name_lookup for the TEMPLATE_DECL is
Outer (whereas for the injected-class-name it's also Inner<int>).
The simplest fix seems to be to check access of the original lookup
result (the injected-class-name) instead of the adjusted result (the
TEMPLATE_DECL). So this patch moves the access check in
cp_parser_lookup_name to before the injected-class-name adjustment.
PR c++/100918
gcc/cp/ChangeLog:
* parser.c (cp_parser_lookup_name): Check access of the lookup
result before we potentially adjust an injected-class-name to
its TEMPLATE_DECL.
gcc/testsuite/ChangeLog:
* g++.dg/template/access38.C: New test.
Diffstat (limited to 'gcc/bitmap.h')
0 files changed, 0 insertions, 0 deletions