diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-06-23 16:18:55 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-06-23 16:18:55 -0400 |
commit | 01aff2ba18a654324957af446a3065db489c0f14 (patch) | |
tree | d353dc5418891eb6c4b6330339f7c3a0274112ab /gcc/d/expr.cc | |
parent | 5ee8e1d1b0c0d9f6310d27a37a6162e0be80e413 (diff) | |
download | gcc-01aff2ba18a654324957af446a3065db489c0f14.zip gcc-01aff2ba18a654324957af446a3065db489c0f14.tar.gz gcc-01aff2ba18a654324957af446a3065db489c0f14.tar.bz2 |
c++: context completion in lookup_template_class [PR105982]
The below testcase demonstrates that completion of the substituted
context during lookup_template_class can end up registering the desired
specialization for us in more cases than r13-1045-gcb7fd1ea85feea
anticipated. In particular this can happen for a non-dependent
specialization of a nested class as well.
For this testcase, during overload resolution with A's guides, we
substitute the deduced argument T=int into the TYPENAME_TYPE B::C,
during which we call lookup_template_class for A<T>::B with T=int,
which completes A<int> for the first time, which recursively registers
the desired specialization of B already. The parent call to
lookup_template_class then tries to register the same specialization,
triggering an ICE.
This patch fixes this by making lookup_template_class determine more
directly whether we need to recheck the specializations table after
completion of the context -- when and only when the call to complete_type
had an effect.
PR c++/105982
gcc/cp/ChangeLog:
* pt.cc (lookup_template_class): After calling complete_type for
the substituted context, check the table again iff the type was
previously incomplete and complete_type made it complete.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/class-deduction111.C: New test.
Diffstat (limited to 'gcc/d/expr.cc')
0 files changed, 0 insertions, 0 deletions