repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Daily bump.
[official-gcc.git]
/
libgomp
/
testsuite
/
libgomp.c++
/
ctor-12.C
blob
8bd53de3f23d14dc14af91ed87d5583d2154bcf6
1
// PR c++/36308
2
// { dg-do run }
3
4
extern "C" void abort ();
5
6
static int n;
7
8
struct A
9
{
10
A ()
11
{
12
l = 0;
13
#pragma omp atomic
14
ctors++;
15
}
16
A (const A &x)
17
{
18
l = x.l;
19
#pragma omp atomic
20
copyctors++;
21
}
22
virtual A& operator= (const A &x)
23
{
24
l = x.l;
25
#pragma omp atomic
26
assignops++;
27
return *this;
28
}
29
virtual ~A ()
30
{
31
#pragma omp atomic
32
dtors++;
33
}
34
int l;
35
static int ctors, dtors, copyctors, assignops;
36
};
37
38
int A::ctors;
39
int A::dtors;
40
int A::copyctors;
41
int A::assignops;
42
43
int
44
main ()
45
{
46
A a;
47
#pragma omp parallel private (a)
48
{
49
a.l = 6;
50
#pragma omp single copyprivate (a)
51
{
52
a.l = 3;
53
}
54
if (a.l != 3)
55
abort ();
56
#pragma omp atomic
57
n++;
58
}
59
if (A::ctors != n + 1
60
|| A::copyctors != 0
61
|| A::dtors != n
62
|| A::assignops != n - 1)
63
abort ();
64
return 0;
65
}