]> gcc.gnu.org Git - gcc.git/commit
c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression evaluatio...
authorJakub Jelinek <jakub@redhat.com>
Wed, 1 Feb 2023 09:38:46 +0000 (10:38 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 1 Feb 2023 09:38:46 +0000 (10:38 +0100)
commitbfc070595bfb00abef88a002eee5d9117f5b86a7
tree1ba714205e9730b198b4466741e3ba89750f0506
parent8091199cdf4d0aa9c28e4526548ddc25d02898ca
c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression evaluation [PR108607]

While potential_constant_expression_1 handled most of OMP_* codes (by saying that
they aren't potential constant expressions), OMP_SCOPE was missing in that list.
I've also added OMP_SCAN, though that is less important (similarly to OMP_SECTION
it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
As the testcase shows, it isn't enough, potential_constant_expression_1
can catch only some cases, as soon as one uses switch or ifs where at least
one of the possible paths could be constant expression, we can run into the
same codes during cxx_eval_constant_expression, so this patch handles those
there as well.

2023-02-01  Jakub Jelinek  <jakub@redhat.com>

PR c++/108607
* constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
and OACC_* constructs as non-constant.
(potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.

* g++.dg/gomp/pr108607.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/gomp/pr108607.C [new file with mode: 0644]
This page took 0.055641 seconds and 5 git commands to generate.