1 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s
6 bool foobool(int argc) {
10 struct S1; // expected-note 2 {{declared here}}
12 template <typename T, int C> // expected-note {{declared here}}
16 #pragma omp teams distribute parallel for simd num_teams(C)
17 for (int i=0; i<100; i++) foo();
19 #pragma omp teams distribute parallel for simd num_teams(T) // expected-error {{'T' does not refer to a value}}
20 for (int i=0; i<100; i++) foo();
22 #pragma omp teams distribute parallel for simd num_teams // expected-error {{expected '(' after 'num_teams'}}
23 for (int i=0; i<100; i++) foo();
25 #pragma omp teams distribute parallel for simd num_teams( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
26 for (int i=0; i<100; i++) foo();
28 #pragma omp teams distribute parallel for simd num_teams() // expected-error {{expected expression}}
29 for (int i=0; i<100; i++) foo();
31 #pragma omp teams distribute parallel for simd num_teams(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
32 for (int i=0; i<100; i++) foo();
34 #pragma omp teams distribute parallel for simd num_teams(argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
35 for (int i=0; i<100; i++) foo();
37 #pragma omp teams distribute parallel for simd num_teams(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
38 for (int i=0; i<100; i++) foo();
40 #pragma omp teams distribute parallel for simd num_teams(argc + argc)
41 for (int i=0; i<100; i++) foo();
43 #pragma omp teams distribute parallel for simd num_teams(argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'num_teams' clause}}
44 for (int i=0; i<100; i++) foo();
46 #pragma omp teams distribute parallel for simd num_teams(S1) // expected-error {{'S1' does not refer to a value}}
47 for (int i=0; i<100; i++) foo();
49 #pragma omp teams distribute parallel for simd num_teams(-2) // expected-error {{argument to 'num_teams' clause must be a strictly positive integer value}}
50 for (int i=0; i<100; i++) foo();
52 #pragma omp teams distribute parallel for simd num_teams(-10u)
53 for (int i=0; i<100; i++) foo();
55 #pragma omp teams distribute parallel for simd num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
56 for (int i=0; i<100; i++) foo();
61 int main(int argc, char **argv) {
63 #pragma omp teams distribute parallel for simd num_teams // expected-error {{expected '(' after 'num_teams'}}
64 for (int i=0; i<100; i++) foo();
67 #pragma omp teams distribute parallel for simd num_teams ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
68 for (int i=0; i<100; i++) foo();
71 #pragma omp teams distribute parallel for simd num_teams () // expected-error {{expected expression}}
72 for (int i=0; i<100; i++) foo();
75 #pragma omp teams distribute parallel for simd num_teams (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
76 for (int i=0; i<100; i++) foo();
79 #pragma omp teams distribute parallel for simd num_teams (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
80 for (int i=0; i<100; i++) foo();
83 #pragma omp teams distribute parallel for simd num_teams (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
84 for (int i=0; i<100; i++) foo();
87 #pragma omp teams distribute parallel for simd num_teams (argc + argc)
88 for (int i=0; i<100; i++) foo();
91 #pragma omp teams distribute parallel for simd num_teams (argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'num_teams' clause}}
92 for (int i=0; i<100; i++) foo();
95 #pragma omp teams distribute parallel for simd num_teams (S1) // expected-error {{'S1' does not refer to a value}}
96 for (int i=0; i<100; i++) foo();
99 #pragma omp teams distribute parallel for simd num_teams (-2) // expected-error {{argument to 'num_teams' clause must be a strictly positive integer value}}
100 for (int i=0; i<100; i++) foo();
103 #pragma omp teams distribute parallel for simd num_teams (-10u)
104 for (int i=0; i<100; i++) foo();
107 #pragma omp teams distribute parallel for simd num_teams (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
108 for (int i=0; i<100; i++) foo();
110 return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}}