]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix up #pragma omp declare {simd,variant} and acc routine parsing
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Aug 2021 09:09:00 +0000 (11:09 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Thu, 12 Aug 2021 09:09:00 +0000 (11:09 +0200)
commit1f1509520fc653af3f0b2c883bc6d7370d33638c
treec949be4e8ca947442ab5eb2a2ee2af8e904469c8
parent6843be6997fcb42c7e3c0a8d60c90883aff0fbf9
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.

(cherry picked from commit af31cab04770f7a1a1da069415ab62ca2ef54fc4)
gcc/cp/ChangeLog.omp
gcc/cp/parser.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/g++.dg/goacc/pr101759.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/pr101759.C [new file with mode: 0644]