@@ -30623,6 +30623,10 @@ cp_parser_omp_declare_reduction (cp_pars
cp_token *first_token;
cp_token_cache *cp;
int errs;
+ void *p;
+
+ /* Get the high-water mark for the DECLARATOR_OBSTACK. */
+ p = obstack_alloc (&declarator_obstack, 0);
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
goto fail;
@@ -30731,6 +30735,9 @@ cp_parser_omp_declare_reduction (cp_pars
{
fail:
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
+
+ /* Free any declarators allocated. */
+ obstack_free (&declarator_obstack, p);
return;
}
@@ -30835,6 +30842,9 @@ cp_parser_omp_declare_reduction (cp_pars
}
cp_parser_require_pragma_eol (parser, pragma_tok);
+
+ /* Free any declarators allocated. */
+ obstack_free (&declarator_obstack, p);
}
/* OpenMP 4.0
@@ -0,0 +1,6 @@
+/* PR c++/58703 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#pragma omp declare reduction (+ : char[] : omp_out += omp_in) /* { dg-error "function or array type" } */
+#pragma omp declare reduction (+ : char() : omp_out += omp_in) /* { dg-error "function or array type" } */