annotate gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile }
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 struct S { int x; } s;
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 // Make sure we detect errors on non-type-dependent things
kono
parents:
diff changeset
6 // even when the templates are never instantiated.
kono
parents:
diff changeset
7 template<typename T> void f1()
kono
parents:
diff changeset
8 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
9 #pragma omp atomic // { dg-error "invalid" }
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
10 s += 1;
111
kono
parents:
diff changeset
11 }
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 template<typename T> void f2(float *f)
kono
parents:
diff changeset
14 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
15 #pragma omp atomic // { dg-error "invalid" }
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
16 *f |= 1; // { dg-message "evaluation" "" { target *-*-* } .-1 }
111
kono
parents:
diff changeset
17 }
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 // Here the rhs is dependent, but not type dependent.
kono
parents:
diff changeset
20 template<typename T> void f3(float *f)
kono
parents:
diff changeset
21 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
22 #pragma omp atomic // { dg-error "invalid" }
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
23 *f |= sizeof (T); // { dg-message "evaluation" "" { target *-*-* } .-1 }
111
kono
parents:
diff changeset
24 }
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 // And the converse, no error here because we're never fed a T.
kono
parents:
diff changeset
27 template<typename T> void f4(T *t)
kono
parents:
diff changeset
28 {
kono
parents:
diff changeset
29 #pragma omp atomic
kono
parents:
diff changeset
30 *t += 1;
kono
parents:
diff changeset
31 }
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 // Here we'll let it go, because the rhs is type dependent and
kono
parents:
diff changeset
34 // we can't properly instantiate the statement, and we do most
kono
parents:
diff changeset
35 // of the semantic analysis concurrent with that.
kono
parents:
diff changeset
36 template<typename T> void f5(float *f)
kono
parents:
diff changeset
37 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
38 #pragma omp atomic // { dg-error "invalid" "" { xfail *-*-* } }
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
39 *f |= (T)sizeof(T); // { dg-error "evaluation" "" { xfail *-*-* } }
111
kono
parents:
diff changeset
40 }