libgomp/testsuite/libgomp.c++/pr81314.C
raw| 1 | // PR c++/81314 |
| 2 | // { dg-do link } |
| 3 | |
| 4 | template <int N> |
| 5 | struct S { |
| 6 | S () { s = 0; } |
| 7 | S (const S &x) { s = x.s; } |
| 8 | ~S () {} |
| 9 | int s; |
| 10 | }; |
| 11 | |
| 12 | void |
| 13 | foo (S<2> &x) |
| 14 | { |
| 15 | #pragma omp taskloop |
| 16 | for (int i = 0; i < 100; ++i) |
| 17 | x.s++; |
| 18 | } |
| 19 | |
| 20 | void |
| 21 | bar (S<3> &x) |
| 22 | { |
| 23 | #pragma omp task |
| 24 | x.s++; |
| 25 | } |
| 26 | |
| 27 | int |
| 28 | main () |
| 29 | { |
| 30 | S<2> s; |
| 31 | S<3> t; |
| 32 | #pragma omp parallel |
| 33 | #pragma omp master |
| 34 | { |
| 35 | foo (s); |
| 36 | bar (t); |
| 37 | } |
| 38 | } |