aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/pr81130.C
blob: f2cb571294d4c8ebacf9c93257cfe12412e97f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// PR c++/81130
// { dg-do run }

struct A
{
  A ();
  ~A ();
  int a;
};

A::A ()
{
  a = 0;
}

A::~A ()
{
}

struct B
{
  A b;
  int c;
  B () : c (1)
  {
#pragma omp parallel shared (b, c) num_threads (2)
#pragma omp master
    {
      b.a++;
      c += 2;
    }
  }
};

int
main ()
{
  B v;
  if (v.b.a != 1 || v.c != 3)
    __builtin_abort ();
}