aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-12-20 15:02:40 -0500
committerPatrick Palka <ppalka@redhat.com>2021-12-20 15:02:40 -0500
commitab85331c58223e483c55ff0316a92265d7910e9b (patch)
tree65cc274dfb8bb38d9b45e6e99b5f9eb903ef6f6c /libcpp
parentb3f58f87d78b958e35e4a44f5fdb4b7721cb2837 (diff)
downloadgcc-ab85331c58223e483c55ff0316a92265d7910e9b.zip
gcc-ab85331c58223e483c55ff0316a92265d7910e9b.tar.gz
gcc-ab85331c58223e483c55ff0316a92265d7910e9b.tar.bz2
c++: memfn lookup consistency in incomplete-class ctx
When instantiating a call to a member function of a class template, we repeat the member function lookup in order to obtain the corresponding partially instantiated functions. Within an incomplete-class context however, we need to be more careful when repeating the lookup because we don't want to introduce later-declared member functions that weren't visible at template definition time. We're currently not careful enough in this respect, which causes us to reject memfn1.C below. This patch fixes this issue by making tsubst_baselink filter out from the instantiation-time lookup those member functions that were invisible at template definition time. This is really only necessary within an incomplete-class context, so this patch adds a heuristic flag to BASELINK to help us avoid needlessly performing this filtering step (which would be a no-op) in complete-class contexts. This is also necessary for the ahead-of-time overload set pruning implemented in r12-6075 to be effective for member functions within class templates. gcc/cp/ChangeLog: * call.c (build_new_method_call): Set BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P on the pruned baselink. * cp-tree.h (BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P): Define. * pt.c (filter_memfn_lookup): New subroutine of tsubst_baselink. (tsubst_baselink): Use filter_memfn_lookup on the new lookup result when BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P is set on the old baselink. Remove redundant BASELINK_P check. * search.c (build_baselink): Set BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P appropriately. gcc/testsuite/ChangeLog: * g++.dg/lookup/memfn1.C: New test. * g++.dg/template/non-dependent16b.C: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions