Debian Codegraph @

gcc/testsuite/g++.dg/gomp/attrs-3.C

raw
1 // { dg-do compile { target c++11 } }
2
3 int i;
4 int t1, t2, t3, t4, t5, t6, t7;
5
6 void
7 foo ()
8 {
9 [[omp::directive]]; // { dg-error "'omp::directive' attribute requires argument" }
10 [[omp::directive ()]]; // { dg-error "expected OpenMP directive name" }
11 [[omp::directive (nonexistent foobar)]]; // { dg-error "unknown OpenMP directive name in 'omp::directive' attribute argument" }
12 [[omp::sequence]]; // { dg-error "'omp::sequence' attribute requires argument" }
13 [[omp::sequence()]]; // { dg-error "expected 'directive' or 'sequence'" }
14 [[omp::sequence(foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
15 [[omp::sequence(omp::foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
16 [[omp::sequence(directive(taskwait), foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
17 [[omp::sequence(omp::directive(taskwait), omp::foobar())]]; // { dg-error "expected 'directive' or 'sequence'" }
18 [[omp::sequence(directive(taskwait) foobar())]]; // { dg-error "expected '\\\)' before 'foobar'" }
19 [[omp::sequence(directive)]]; // { dg-error "expected '\\\(' before '\\\)' token" }
20 [[omp::sequence(omp::sequence)]]; // { dg-error "expected '\\\(' before '\\\)' token" }
21 [[omp::directive (parallel), omp::directive (single)]] // { dg-error "OpenMP construct among 'omp::directive' attributes requires all 'omp::directive' attributes on the same statement to be in the same 'omp::sequence'" }
22 ;
23 [[omp::directive (parallel)]] // { dg-error "OpenMP construct among 'omp::directive' attributes requires all 'omp::directive' attributes on the same statement to be in the same 'omp::sequence'" }
24 [[omp::directive (single)]]
25 ;
26 [[omp::directive (taskwait), omp::directive (taskyield)]] // { dg-error "multiple OpenMP standalone directives among 'omp::directive' attributes must be all within the same 'omp::sequence'" }
27 ;
28 [[omp::directive (taskwait)]]
29 [[omp::directive (taskyield)]] // { dg-error "multiple OpenMP standalone directives among 'omp::directive' attributes must be all within the same 'omp::sequence'" }
30 ;
31 [[omp::directive (flush)]] // { dg-error "standalone OpenMP directives in 'omp::directive' attribute can only appear on an empty statement" }
32 i++;
33 auto a = [] () [[omp::directive (threadprivate (t1))]] {}; // { dg-error "'omp::directive' not allowed to be specified in this context" }
34 int [[omp::directive (threadprivate (t2))]] b; // { dg-warning "attribute ignored" }
35 int *[[omp::directive (threadprivate (t3))]] c; // { dg-error "'omp::directive' not allowed to be specified in this context" }
36 int &[[omp::directive (threadprivate (t4))]] d = b; // { dg-error "'omp::directive' not allowed to be specified in this context" }
37 typedef int T [[omp::directive (threadprivate (t5))]]; // { dg-error "'omp::directive' not allowed to be specified in this context" }
38 int e [[omp::directive (threadprivate (t6))]] [10]; // { dg-error "'omp::directive' not allowed to be specified in this context" }
39 int f[10] [[omp::directive (threadprivate (t6))]]; // { dg-error "'omp::directive' not allowed to be specified in this context" }
40 struct [[omp::directive (threadprivate (t7))]] S {}; // { dg-error "'omp::directive' not allowed to be specified in this context" }
41 }