aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9849e59..0da3839 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -42616,16 +42616,9 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
cp_parser_push_lexer_for_tokens (parser, cp);
parser->lexer->in_pragma = true;
}
- if (!cp_parser_omp_declare_reduction_exprs (fndecl, parser))
- {
- if (!block_scope)
- finish_function (/*inline_p=*/false);
- else
- DECL_CONTEXT (fndecl) = current_function_decl;
- if (cp)
- cp_parser_pop_lexer (parser);
- goto fail;
- }
+
+ bool ok = cp_parser_omp_declare_reduction_exprs (fndecl, parser);
+
if (cp)
cp_parser_pop_lexer (parser);
if (!block_scope)
@@ -42633,6 +42626,14 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
else
{
DECL_CONTEXT (fndecl) = current_function_decl;
+ if (DECL_TEMPLATE_INFO (fndecl))
+ DECL_CONTEXT (DECL_TI_TEMPLATE (fndecl)) = current_function_decl;
+ }
+ if (!ok)
+ goto fail;
+
+ if (block_scope)
+ {
block = finish_omp_structured_block (block);
if (TREE_CODE (block) == BIND_EXPR)
DECL_SAVED_TREE (fndecl) = BIND_EXPR_BODY (block);
@@ -42641,6 +42642,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
if (processing_template_decl)
add_decl_expr (fndecl);
}
+
cp_check_omp_declare_reduction (fndecl);
if (cp == NULL && types.length () > 1)
cp = cp_token_cache_new (first_token,