Hi!

At least for now, unless OpenMP 5.0 will say something different,
#pragma omp simd is not usable in constexpr, but was forgotten in this spot.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk. 

2018-02-19  Jakub Jelinek  <ja...@redhat.com>

        PR c++/84430
        * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.

        * g++.dg/gomp/pr84430.C: New test.

--- gcc/cp/constexpr.c.jj       2018-02-16 23:38:05.138373372 +0100
+++ gcc/cp/constexpr.c  2018-02-19 15:28:41.907846544 +0100
@@ -5604,6 +5604,7 @@ potential_constant_expression_1 (tree t,
     case OMP_PARALLEL:
     case OMP_TASK:
     case OMP_FOR:
+    case OMP_SIMD:
     case OMP_DISTRIBUTE:
     case OMP_TASKLOOP:
     case OMP_TEAMS:
--- gcc/testsuite/g++.dg/gomp/pr84430.C.jj      2018-02-19 15:34:52.397001027 
+0100
+++ gcc/testsuite/g++.dg/gomp/pr84430.C 2018-02-19 15:36:25.037039654 +0100
@@ -0,0 +1,12 @@
+// PR c++/84430
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+  auto a = [] {
+    #pragma omp simd
+    for (int i = 0; i < 10; ++i)
+      ;
+  };
+}

        Jakub

Reply via email to