aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-08-04 11:53:48 +0200
committerJakub Jelinek <jakub@redhat.com>2021-08-04 11:53:48 +0200
commitaf31cab04770f7a1a1da069415ab62ca2ef54fc4 (patch)
tree7af60b9de7944c6b558357c34908c1bf362abb25 /gcc/cp
parent8aa14fa7d98b4d641de9c3ea8d0fa094e0a0ec76 (diff)
downloadgcc-af31cab04770f7a1a1da069415ab62ca2ef54fc4.zip
gcc-af31cab04770f7a1a1da069415ab62ca2ef54fc4.tar.gz
gcc-af31cab04770f7a1a1da069415ab62ca2ef54fc4.tar.bz2
c++: Fix up #pragma omp declare {simd,variant} and acc routine parsing
When parsing default arguments, we need to temporarily clear parser->omp_declare_simd and parser->oacc_routine, otherwise it can clash with further declarations inside of e.g. lambdas inside of those default arguments. 2021-08-04 Jakub Jelinek <jakub@redhat.com> PR c++/101759 * parser.c (cp_parser_default_argument): Temporarily override parser->omp_declare_simd and parser->oacc_routine to NULL. * g++.dg/gomp/pr101759.C: New test. * g++.dg/goacc/pr101759.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/parser.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 47bf7d9..02ce954 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -24488,6 +24488,8 @@ cp_parser_default_argument (cp_parser *parser, bool template_parm_p)
set correctly. */
saved_greater_than_is_operator_p = parser->greater_than_is_operator_p;
parser->greater_than_is_operator_p = !template_parm_p;
+ auto odsd = make_temp_override (parser->omp_declare_simd, NULL);
+ auto ord = make_temp_override (parser->oacc_routine, NULL);
/* Local variable names (and the `this' keyword) may not
appear in a default argument. */
saved_local_variables_forbidden_p = parser->local_variables_forbidden_p;