c++: Fix up #pragma omp declare {simd,variant} and acc routine parsing
authorJakub Jelinek <jakub@redhat.com>
Wed, 4 Aug 2021 09:53:48 +0000 (11:53 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 4 Aug 2021 09:53:48 +0000 (11:53 +0200)
commitaf31cab04770f7a1a1da069415ab62ca2ef54fc4
tree7af60b9de7944c6b558357c34908c1bf362abb25
parent8aa14fa7d98b4d641de9c3ea8d0fa094e0a0ec76
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.
gcc/cp/parser.c
gcc/testsuite/g++.dg/goacc/pr101759.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/pr101759.C [new file with mode: 0644]