blob: cc42c97ad8ac3deae2a2a8627d3906e20bdfcb34 [file] [log] [blame]
Alexey Bataeva9148882019-07-08 15:45:24 +00001// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s -Wuninitialized
Kelvin Lia15fb1a2015-11-27 18:47:36 +00002
Alexey Bataeva9148882019-07-08 15:45:24 +00003// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 100 -o - %s -Wuninitialized
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004
Kelvin Lia15fb1a2015-11-27 18:47:36 +00005void foo() {
6}
7
8bool foobool(int argc) {
9 return argc;
10}
11
12struct S1; // expected-note 2 {{declared here}}
13
14template <typename T, int C> // expected-note {{declared here}}
15T tmain(T argc) {
16 char **a;
Alexey Bataeva9148882019-07-08 15:45:24 +000017 T z;
Kelvin Lia15fb1a2015-11-27 18:47:36 +000018#pragma omp target
19#pragma omp teams thread_limit(C)
20 foo();
21#pragma omp target
22#pragma omp teams thread_limit(T) // expected-error {{'T' does not refer to a value}}
23 foo();
24#pragma omp target
25#pragma omp teams thread_limit // expected-error {{expected '(' after 'thread_limit'}}
26 foo();
27#pragma omp target
28#pragma omp teams thread_limit( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
29 foo();
30#pragma omp target
31#pragma omp teams thread_limit() // expected-error {{expected expression}}
32 foo();
33#pragma omp target
34#pragma omp teams thread_limit(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
35 foo();
36#pragma omp target
37#pragma omp teams thread_limit(argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}}
38 foo();
39#pragma omp target
40#pragma omp teams thread_limit(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
41 foo();
42#pragma omp target
Alexey Bataeva9148882019-07-08 15:45:24 +000043#pragma omp teams thread_limit(argc + argc + z)
Kelvin Lia15fb1a2015-11-27 18:47:36 +000044 foo();
45#pragma omp target
46#pragma omp teams thread_limit(argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'thread_limit' clause}}
47 foo();
48#pragma omp target
49#pragma omp teams thread_limit(S1) // expected-error {{'S1' does not refer to a value}}
50 foo();
51#pragma omp target
Alexey Bataeva0569352015-12-01 10:17:31 +000052#pragma omp teams thread_limit(-2) // expected-error {{argument to 'thread_limit' clause must be a strictly positive integer value}}
Kelvin Lia15fb1a2015-11-27 18:47:36 +000053 foo();
54#pragma omp target
55#pragma omp teams thread_limit(-10u)
56 foo();
57#pragma omp target
58#pragma omp teams thread_limit(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
59 foo();
60
61 return 0;
62}
63
64int main(int argc, char **argv) {
Alexey Bataeva9148882019-07-08 15:45:24 +000065 int z;
Kelvin Lia15fb1a2015-11-27 18:47:36 +000066#pragma omp target
67#pragma omp teams thread_limit // expected-error {{expected '(' after 'thread_limit'}}
68 foo();
69
70#pragma omp target
71#pragma omp teams thread_limit ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
72 foo();
73
74#pragma omp target
75#pragma omp teams thread_limit () // expected-error {{expected expression}}
76 foo();
77
78#pragma omp target
79#pragma omp teams thread_limit (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
80 foo();
81
82#pragma omp target
83#pragma omp teams thread_limit (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}}
84 foo();
85
86#pragma omp target
87#pragma omp teams thread_limit (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
88 foo();
89
90#pragma omp target
Alexey Bataeva9148882019-07-08 15:45:24 +000091#pragma omp teams thread_limit (argc + argc - z)
Kelvin Lia15fb1a2015-11-27 18:47:36 +000092 foo();
93
94#pragma omp target
95#pragma omp teams thread_limit (argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'thread_limit' clause}}
96 foo();
97
98#pragma omp target
99#pragma omp teams thread_limit (S1) // expected-error {{'S1' does not refer to a value}}
100 foo();
101
102#pragma omp target
Alexey Bataeva0569352015-12-01 10:17:31 +0000103#pragma omp teams thread_limit (-2) // expected-error {{argument to 'thread_limit' clause must be a strictly positive integer value}}
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000104 foo();
105
106#pragma omp target
107#pragma omp teams thread_limit (-10u)
108 foo();
109
110#pragma omp target
111#pragma omp teams thread_limit (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
112 foo();
113
114 return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}}
115}