libgomp/testsuite/libgomp.c++/pr82835.C
raw| 1 | // PR c++/82835 |
| 2 | // { dg-do run } |
| 3 | |
| 4 | int a, b; |
| 5 | |
| 6 | template <class> |
| 7 | struct C { |
| 8 | C (int x = a) : c (5) { if (x != 137) __builtin_abort (); } |
| 9 | int c; |
| 10 | }; |
| 11 | |
| 12 | struct D { |
| 13 | void foo (); |
| 14 | int d; |
| 15 | }; |
| 16 | |
| 17 | void |
| 18 | D::foo () |
| 19 | { |
| 20 | C<int> c; |
| 21 | #pragma omp for private (c) |
| 22 | for (b = 0; b < d; b++) |
| 23 | c.c++; |
| 24 | } |
| 25 | |
| 26 | int |
| 27 | main () |
| 28 | { |
| 29 | a = 137; |
| 30 | D d; |
| 31 | d.d = 16; |
| 32 | d.foo (); |
| 33 | return 0; |
| 34 | } |