Debian Codegraph @

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

raw
1 /* Test parsing of #pragma omp dispatch */
2 /* { dg-do compile } */
3
4 struct S {
5 int a;
6 int b;
7 virtual int f (double);
8 };
9
10 int f0 (int);
11
12 void f1 (void)
13 {
14 int a, b;
15 double x;
16 int arr[1];
17 S s;
18
19 #pragma omp dispatch
20 int c = f0 (a); /* { dg-error "expected primary-expression before 'int'" } */
21 #pragma omp dispatch
22 int f2 (int d); /* { dg-error "expected primary-expression before 'int'" } */
23 #pragma omp dispatch
24 a = b; /* { dg-error "expected target-function call" } */
25 #pragma omp dispatch
26 s.a = f0(a) + b; /* { dg-error "expected ';' before '\\+' token" } */
27 #pragma omp dispatch
28 b = !f0(a); /* { dg-error "expected primary-expression before '!' token" } */
29 #pragma omp dispatch
30 s.b += f0(s.a); /* { dg-error "expected '=' before '\\+=' token" } */
31 #pragma omp dispatch
32 #pragma omp threadprivate(a) /* { dg-error "'#pragma' is not allowed here" } */
33 a = f0(b);
34 #pragma omp dispatch
35 a = s.f(x); /* { dg-error "'f' is a virtual function but only a direct call is allowed in a dispatch construct" } */
36
37 #pragma omp dispatch nocontext(s) /* { dg-error "could not convert 's' from 'S' to 'bool'" } */
38 f0(a);
39 #pragma omp dispatch nocontext(a, b) /* { dg-error "expected '\\)' before ','" } */
40 f0(a);
41 #pragma omp dispatch nocontext(a) nocontext(b) /* { dg-error "too many 'nocontext' clauses" } */
42 f0(a);
43 #pragma omp dispatch novariants(s) /* { dg-error "could not convert 's' from 'S' to 'bool'" } */
44 f0(a);
45 #pragma omp dispatch novariants(a, b) /* { dg-error "expected '\\)' before ','" } */
46 f0(a);
47 #pragma omp dispatch novariants(a) novariants(b) /* { dg-error "too many 'novariants' clauses" } */
48 f0(a);
49 #pragma omp dispatch nowait nowait /* { dg-error "too many 'nowait' clauses" } */
50 f0(a);
51 #pragma omp dispatch device(x) /* { dg-error "'device' id must be integral" } */
52 f0(a);
53 #pragma omp dispatch device(arr) /* { dg-error "'device' id must be integral" } */
54 f0(a);
55 #pragma omp dispatch is_device_ptr(x) /* { dg-error "'is_device_ptr' variable is neither a pointer, nor an array nor reference to pointer" } */
56 f0(a);
57 #pragma omp dispatch is_device_ptr(&x) /* { dg-error "expected unqualified-id before '&' token" } */
58 f0(a);
59 #pragma omp dispatch depend(inout: s.f) /* { dg-error "'s.S::f' is not lvalue expression nor array section in 'depend' clause" } */
60 f0(a);
61
62 }