aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-06-26 11:05:54 -0400
committerPatrick Palka <ppalka@redhat.com>2021-06-26 11:05:54 -0400
commit9f26e34a5a9614a5b66f146752ecef9ea67b3e2d (patch)
tree78c1e0590cf7d9cc960f0d09d3b7d98455b7046f /gcc/fold-const.c
parent5b1ce655b25040048861af6c0264cb667b66fcd7 (diff)
downloadgcc-9f26e34a5a9614a5b66f146752ecef9ea67b3e2d.zip
gcc-9f26e34a5a9614a5b66f146752ecef9ea67b3e2d.tar.gz
gcc-9f26e34a5a9614a5b66f146752ecef9ea67b3e2d.tar.bz2
c++: access scope during partial spec matching [PR96204]
Here, when determining whether the partial specialization matches has_type_member<Child>, we do so from the scope of where the template-id appears rather than from the scope of the specialization, and this causes us to select the partial specialization (since Child::type is accessible from Parent). When we later instantiate this partial specialization, we've entered the scope of the specialization and so substitution into e.g. the DECL_CONTEXT of has_type_member::value fails with access errors since the friend declaration that we relied on to choose the partial specialization no longer applies. It seems the appropriate access scope from which to perform partial specialization matching is the specialization itself (similar to how we check access of base-clauses), which is what this patch implements. PR c++/96204 gcc/cp/ChangeLog: * pt.c (instantiate_class_template_1): Enter the scope of the type when calling most_specialized_partial_spec. gcc/testsuite/ChangeLog: * g++.dg/template/access40.C: New test. * g++.dg/template/access40a.C: New test.
Diffstat (limited to 'gcc/fold-const.c')
0 files changed, 0 insertions, 0 deletions