diff options
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d93d518..ba52f3b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1895,6 +1895,7 @@ reregister_specialization (tree spec, tree tinfo, tree new_spec) void register_local_specialization (tree spec, tree tmpl) { + gcc_assert (tmpl != spec); local_specializations->put (tmpl, spec); } @@ -9494,30 +9495,14 @@ in_template_function (void) return ret; } -/* Returns true iff we are currently within a template other than a generic - lambda. We test this by finding the outermost closure type and checking - whether it is dependent. */ +/* Returns true iff we are currently within a template other than a + default-capturing generic lambda, so we don't need to worry about semantic + processing. */ bool processing_nonlambda_template (void) { - if (!processing_template_decl) - return false; - - tree outer_closure = NULL_TREE; - for (tree t = current_class_type; t; - t = decl_type_context (TYPE_MAIN_DECL (t))) - { - if (LAMBDA_TYPE_P (t)) - outer_closure = t; - else - break; - } - - if (outer_closure) - return dependent_type_p (outer_closure); - else - return true; + return processing_template_decl && !need_generic_capture (); } /* Returns true if T depends on any template parameter with level LEVEL. */ |