aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-06-30 20:21:16 -0400
committerPatrick Palka <ppalka@redhat.com>2021-06-30 20:21:16 -0400
commit613497aa6e28ca009d8498002424019d2a8a9ca5 (patch)
tree3fef3700df8725b851222f694696d1b784f0e292 /gcc/dwarf2out.c
parent25b6bfea5f14da53116f2d3efe2446de89b9bc03 (diff)
downloadgcc-613497aa6e28ca009d8498002424019d2a8a9ca5.zip
gcc-613497aa6e28ca009d8498002424019d2a8a9ca5.tar.gz
gcc-613497aa6e28ca009d8498002424019d2a8a9ca5.tar.bz2
c++: Extend the PR96204 fix to variable templates too
r12-1829 corrected the access scope during partial specialization matching of class templates, but overlooked the variable template case. This patch moves the access scope adjustment to within most_specialized_partial_spec so that all callers can benefit. This patch also adjusts a couple of these callers to avoid always passing the most general template of a variable template specialization, since that'd cause us to push the wrong access scope for e.g. the second testcase below (we'd push A<T> instead of A<int>/A<char>). We ought to be passing the partially instantiated template instead. PR c++/96204 gcc/cp/ChangeLog: * pt.c (finish_template_variable): Pass the partially instantiated template and its args to instantiate_template. (instantiate_class_template_1): No need to call push_nested_class and pop_nested_class around the call to most_specialized_partial_spec. (instantiate_template_1): Pass the partially instantiated template to lookup_template_variable. (most_specialized_partial_spec): Use push_access_scope_guard to set the access scope appropriately. Use deferring_access_check_sentinel to force access to get checked immediately. (instantiate_decl): Just pass the VAR_DECL to most_specialized_partial_spec. gcc/testsuite/ChangeLog: * g++.dg/template/access41.C: New test. * g++.dg/template/access41a.C: New test.
Diffstat (limited to 'gcc/dwarf2out.c')
0 files changed, 0 insertions, 0 deletions