c++: bad pending_template recursion
limit_bad_template_recursion currently avoids immediate instantiation of
templates from uses in an already ill-formed instantiation, but we still can
get unnecessary recursive instantiation in pending_templates if the
instantiation was queued before the error.
Initially this regressed several libstdc++ tests which seemed to rely on a
static_assert in a function called from another that is separately ill-formed.
For instance, in the 48101_neg.cc tests, we first got an error in find(), then
later instantiate _S_key() (called from find) and got the static_assert error
from there.
r16-131-g876d1a22dfaf87 and
r16-132-g901900bc37566c changed
the library code (and tests) to make the expected static_assert errors
happen earlier.
gcc/cp/ChangeLog:
* cp-tree.h (struct tinst_level): Add had_errors bit.
* pt.cc (push_tinst_level_loc): Clear it.
(pop_tinst_level): Set it.
(reopen_tinst_level): Check it.
(instantiate_pending_templates): Call limit_bad_template_recursion.
gcc/testsuite/ChangeLog:
* g++.dg/template/recurse5.C: New test.