diff options
-rw-r--r-- | gcc/cp/parser.c | 12 | ||||
-rw-r--r-- | gcc/cp/pt.c | 9 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 03780fa..52637b1 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -42700,15 +42700,19 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, DECL_ATTRIBUTES (fndecl) = tree_cons (get_identifier ("gnu_inline"), NULL_TREE, DECL_ATTRIBUTES (fndecl)); - if (processing_template_decl) - fndecl = push_template_decl (fndecl); bool block_scope = false; - tree block = NULL_TREE; if (current_function_decl) { block_scope = true; DECL_CONTEXT (fndecl) = current_function_decl; DECL_LOCAL_DECL_P (fndecl) = true; + } + + if (processing_template_decl) + fndecl = push_template_decl (fndecl); + + if (block_scope) + { if (!processing_template_decl) pushdecl (fndecl); } @@ -42736,6 +42740,8 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, /* We should never meet a matched duplicate decl. */ gcc_checking_assert (d == error_mark_node || d == fndecl); } + + tree block = NULL_TREE; if (!block_scope) start_preparsed_function (fndecl, NULL_TREE, SF_PRE_PARSED); else diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0d2946f..fdeaa02 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25595,9 +25595,11 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p) if (nested_p) block = push_stmt_list (); else - start_preparsed_function (d, NULL_TREE, SF_PRE_PARSED); + { + start_preparsed_function (d, NULL_TREE, SF_PRE_PARSED); - perform_instantiation_time_access_checks (code_pattern, args); + perform_instantiation_time_access_checks (code_pattern, args); + } /* Create substitution entries for the parameters. */ register_parameter_specializations (code_pattern, d); @@ -25636,7 +25638,8 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p) } /* We're not deferring instantiation any more. */ - TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0; + if (!nested_p) + TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0; if (push_to_top) pop_from_top_level (); |