]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgomp/testsuite/libgomp.c++/pr114572.C
c++: Fix ICE with weird copy assignment operator [PR114572]
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.c++ / pr114572.C
diff --git a/libgomp/testsuite/libgomp.c++/pr114572.C b/libgomp/testsuite/libgomp.c++/pr114572.C
new file mode 100644 (file)
index 0000000..21d5c84
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/114572
+// { dg-do run }
+// { dg-options "-fopenmp -O0" }
+
+#include <stdlib.h>
+
+struct S
+{
+  S () : s (0) {}
+  ~S () {}
+  S operator= (const S &x) { s = x.s; return *this; }
+  int s;
+};
+
+int
+main ()
+{
+  S s;
+  #pragma omp parallel for lastprivate(s)
+  for (int i = 0; i < 10; ++i)
+    s.s = i;
+  if (s.s != 9)
+    abort ();
+}