Debian Codegraph @

libgomp/testsuite/libgomp.c++/pr114572.C

raw
1 // PR c++/114572
2 // { dg-do run }
3 // { dg-options "-fopenmp -O0" }
4
5 #include <stdlib.h>
6
7 struct S
8 {
9 S () : s (0) {}
10 ~S () {}
11 S operator= (const S &x) { s = x.s; return *this; }
12 int s;
13 };
14
15 int
16 main ()
17 {
18 S s;
19 #pragma omp parallel for lastprivate(s)
20 for (int i = 0; i < 10; ++i)
21 s.s = i;
22 if (s.s != 9)
23 abort ();
24 }