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