Hi!

DECL_OMP_PRIVATIZED_MEMBER VAR_DECLs aren't capture proxies, handling them
that way results in various ICEs.

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

2019-01-30  Jakub Jelinek  <ja...@redhat.com>

        PR c++/88988
        * lambda.c (is_capture_proxy): Don't return true for
        DECL_OMP_PRIVATIZED_MEMBER artificial vars.

        * testsuite/libgomp.c++/pr88988.C: New test.

--- gcc/cp/lambda.c.jj  2019-01-30 08:35:47.055054187 +0100
+++ gcc/cp/lambda.c     2019-01-30 14:22:45.324085959 +0100
@@ -263,6 +263,9 @@ is_capture_proxy (tree decl)
          && !DECL_ANON_UNION_VAR_P (decl)
          && !DECL_DECOMPOSITION_P (decl)
          && !DECL_FNAME_P (decl)
+         && !(DECL_ARTIFICIAL (decl)
+              && DECL_LANG_SPECIFIC (decl)
+              && DECL_OMP_PRIVATIZED_MEMBER (decl))
          && LAMBDA_FUNCTION_P (DECL_CONTEXT (decl)));
 }
 
--- libgomp/testsuite/libgomp.c++/pr88988.C.jj  2019-01-30 14:33:42.134276321 
+0100
+++ libgomp/testsuite/libgomp.c++/pr88988.C     2019-01-30 14:33:16.911696846 
+0100
@@ -0,0 +1,28 @@
+// PR c++/88988
+// { dg-do compile }
+// { dg-additional-options "-std=c++14" }
+
+extern "C" void abort ();
+
+template <typename T>
+struct A {
+  A () : a(), b()
+  {
+    [&] ()
+    {
+#pragma omp task firstprivate (a) shared (b)
+      b = ++a;
+#pragma omp taskwait
+    } ();
+  }
+
+  T a, b;
+};
+
+int
+main ()
+{
+  A<int> x;
+  if (x.a != 0 || x.b != 1)
+    abort ();
+}

        Jakub

Reply via email to