[C/C++, OpenACC] Reject vars of different scope in acc declare (PR94120)
authorTobias Burnus <tobias@codesourcery.com>
Wed, 8 Apr 2020 07:39:43 +0000 (09:39 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Wed, 8 Apr 2020 07:39:43 +0000 (09:39 +0200)
commit13e41d8b9d3d7598c72c38acc86a3d97046c8373
tree90000a02958e8b0e36e120c7afcc9b6e839b4c04
parent38c3017f257484a6739e2fba821d95794f7f175c
[C/C++, OpenACC] Reject vars of different scope in acc declare (PR94120)

gcc/c/
PR middle-end/94120
* c-decl.c (c_check_in_current_scope): New function.
* c-tree.h (c_check_in_current_scope): Declare it.
* c-parser.c (c_parser_oacc_declare): Add check that variables
are declared in the same scope as the directive. Fix handling
of namespace vars.

gcc/cp/
PR middle-end/94120
* paser.c (cp_parser_oacc_declare): Add check that variables
are declared in the same scope as the directive.

gcc/testsuite/
PR middle-end/94120
* c-c++-common/goacc/declare-pr94120.c: New.
* g++.dg/declare-pr94120.C: New.

libgomp/testsuite/
PR middle-end/94120
* libgomp.oacc-c++/declare-pr94120.C: New.
12 files changed:
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/c/c-parser.c
gcc/c/c-tree.h
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/omp-grid.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/goacc/declare-pr94120.c [new file with mode: 0644]
gcc/testsuite/g++.dg/declare-pr94120.C [new file with mode: 0644]
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c++/declare-pr94120.C [new file with mode: 0644]