| 1 |
// PR c++/108180 |
| 2 |
// { dg-do run } |
| 3 |
|
| 4 |
struct A { |
| 5 |
A () { ++a; } |
| 6 |
A (A &&) = delete; |
| 7 |
A (const A &) { ++a; } |
| 8 |
A &operator= (const A &) = delete; |
| 9 |
A &operator= (A &&) = delete; |
| 10 |
~A () { --a; } |
| 11 |
static int a; |
| 12 |
}; |
| 13 |
int A::a = 0; |
| 14 |
|
| 15 |
struct B { |
| 16 |
A a; |
| 17 |
template <int N> |
| 18 |
int |
| 19 |
foo () |
| 20 |
{ |
| 21 |
int res = 0; |
| 22 |
#pragma omp parallel for if(false) firstprivate(a) |
| 23 |
for (int i = 0; i < 64; ++i) |
| 24 |
res += i; |
| 25 |
return res; |
| 26 |
} |
| 27 |
int |
| 28 |
bar () |
| 29 |
{ |
| 30 |
int res = 0; |
| 31 |
#pragma omp parallel for if(false) firstprivate(a) |
| 32 |
for (int i = 0; i < 64; ++i) |
| 33 |
res += i; |
| 34 |
return res; |
| 35 |
} |
| 36 |
}; |
| 37 |
|
| 38 |
int |
| 39 |
main () |
| 40 |
{ |
| 41 |
{ |
| 42 |
B b; |
| 43 |
if (b.foo<0> () != 2016) |
| 44 |
__builtin_abort (); |
| 45 |
} |
| 46 |
if (A::a != 0) |
| 47 |
__builtin_abort (); |
| 48 |
{ |
| 49 |
B b; |
| 50 |
if (b.bar () != 2016) |
| 51 |
__builtin_abort (); |
| 52 |
} |
| 53 |
if (A::a != 0) |
| 54 |
__builtin_abort (); |
| 55 |
} |