Debian Codegraph @

gcc/testsuite/g++.dg/gomp/this-2.C

raw
1 // { dg-do compile }
2 // { dg-options "-fopenmp" }
3
4 struct S
5 {
6 void bar (int);
7 };
8
9 void
10 S::bar (int x)
11 {
12 #pragma omp target map (this, x) // { dg-error "cannot take the address of .this., which is an rvalue expression" }
13 ;
14 #pragma omp target map (this[0], x)
15 ;
16 #pragma omp target update to (this, x) // { dg-error "cannot take the address of .this., which is an rvalue expression" }
17 #pragma omp target update to (this[0], x)
18 #pragma omp target update from (this, x) // { dg-error "cannot take the address of .this., which is an rvalue expression" }
19 #pragma omp target update from (this[1], x)
20 }
21
22 template <int N>
23 struct T
24 {
25 void bar (int);
26 };
27
28 template <int N>
29 void
30 T<N>::bar (int x)
31 {
32 #pragma omp target map (this, x) // { dg-error "cannot take the address of .this., which is an rvalue expression" }
33 ;
34 #pragma omp target map (this[0], x)
35 ;
36 #pragma omp target update to (this, x) // { dg-error "cannot take the address of .this., which is an rvalue expression" }
37 #pragma omp target update to (this[0], x)
38 #pragma omp target update from (this, x) // { dg-error "cannot take the address of .this., which is an rvalue expression" }
39 #pragma omp target update from (this[1], x)
40 }
41
42 template struct T<0>;