| 1 |
// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s -Wuninitialized |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 100 -o - %s -Wuninitialized |
| 4 |
|
| 5 |
void foo() { |
| 6 |
} |
| 7 |
|
| 8 |
bool foobool(int argc) { |
| 9 |
return argc; |
| 10 |
} |
| 11 |
|
| 12 |
struct S1; // expected-note 2 {{declared here}} |
| 13 |
|
| 14 |
template <typename T, int C> // expected-note {{declared here}} |
| 15 |
T tmain(T argc) { |
| 16 |
char **a; |
| 17 |
T z; |
| 18 |
#pragma omp target |
| 19 |
#pragma omp teams num_teams(C) |
| 20 |
foo(); |
| 21 |
#pragma omp target |
| 22 |
#pragma omp teams num_teams(T) // expected-error {{'T' does not refer to a value}} |
| 23 |
foo(); |
| 24 |
#pragma omp target |
| 25 |
#pragma omp teams num_teams // expected-error {{expected '(' after 'num_teams'}} |
| 26 |
foo(); |
| 27 |
#pragma omp target |
| 28 |
#pragma omp teams num_teams( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 29 |
foo(); |
| 30 |
#pragma omp target |
| 31 |
#pragma omp teams num_teams() // expected-error {{expected expression}} |
| 32 |
foo(); |
| 33 |
#pragma omp target |
| 34 |
#pragma omp teams num_teams(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 35 |
foo(); |
| 36 |
#pragma omp target |
| 37 |
#pragma omp teams num_teams(argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 38 |
foo(); |
| 39 |
#pragma omp target |
| 40 |
#pragma omp teams num_teams(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} |
| 41 |
foo(); |
| 42 |
#pragma omp target |
| 43 |
#pragma omp teams num_teams(argc + argc+z) |
| 44 |
foo(); |
| 45 |
#pragma omp target |
| 46 |
#pragma omp teams num_teams(argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'num_teams' clause}} |
| 47 |
foo(); |
| 48 |
#pragma omp target |
| 49 |
#pragma omp teams num_teams(S1) // expected-error {{'S1' does not refer to a value}} |
| 50 |
foo(); |
| 51 |
#pragma omp target |
| 52 |
#pragma omp teams num_teams(-2) // expected-error {{argument to 'num_teams' clause must be a strictly positive integer value}} |
| 53 |
foo(); |
| 54 |
#pragma omp target |
| 55 |
#pragma omp teams num_teams(-10u) |
| 56 |
foo(); |
| 57 |
#pragma omp target |
| 58 |
#pragma omp teams num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}} |
| 59 |
foo(); |
| 60 |
#pragma omp target |
| 61 |
#pragma omp teams num_teams (1, 2, 3) // expected-error {{only one expression allowed in 'num_teams' clause}} |
| 62 |
foo(); |
| 63 |
#pragma omp target |
| 64 |
#pragma omp teams thread_limit(1, 2, 3) // expected-error {{only one expression allowed in 'thread_limit' clause}} |
| 65 |
foo(); |
| 66 |
|
| 67 |
return 0; |
| 68 |
} |
| 69 |
|
| 70 |
int main(int argc, char **argv) { |
| 71 |
int z; |
| 72 |
#pragma omp target |
| 73 |
#pragma omp teams num_teams // expected-error {{expected '(' after 'num_teams'}} |
| 74 |
foo(); |
| 75 |
|
| 76 |
#pragma omp target |
| 77 |
#pragma omp teams num_teams ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 78 |
foo(); |
| 79 |
|
| 80 |
#pragma omp target |
| 81 |
#pragma omp teams num_teams () // expected-error {{expected expression}} |
| 82 |
foo(); |
| 83 |
|
| 84 |
#pragma omp target |
| 85 |
#pragma omp teams num_teams (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 86 |
foo(); |
| 87 |
|
| 88 |
#pragma omp target |
| 89 |
#pragma omp teams num_teams (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 90 |
foo(); |
| 91 |
|
| 92 |
#pragma omp target |
| 93 |
#pragma omp teams num_teams (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} |
| 94 |
foo(); |
| 95 |
|
| 96 |
#pragma omp target |
| 97 |
#pragma omp teams num_teams (argc + argc-z) |
| 98 |
foo(); |
| 99 |
|
| 100 |
#pragma omp target |
| 101 |
#pragma omp teams num_teams (argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'num_teams' clause}} |
| 102 |
foo(); |
| 103 |
|
| 104 |
#pragma omp target |
| 105 |
#pragma omp teams num_teams (S1) // expected-error {{'S1' does not refer to a value}} |
| 106 |
foo(); |
| 107 |
|
| 108 |
#pragma omp target |
| 109 |
#pragma omp teams num_teams (-2) // expected-error {{argument to 'num_teams' clause must be a strictly positive integer value}} |
| 110 |
foo(); |
| 111 |
|
| 112 |
#pragma omp target |
| 113 |
#pragma omp teams num_teams (-10u) |
| 114 |
foo(); |
| 115 |
|
| 116 |
#pragma omp target |
| 117 |
#pragma omp teams num_teams (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}} |
| 118 |
foo(); |
| 119 |
|
| 120 |
#pragma omp target |
| 121 |
#pragma omp teams num_teams (1, 2, 3) // expected-error {{only one expression allowed in 'num_teams' clause}} |
| 122 |
foo(); |
| 123 |
|
| 124 |
#pragma omp target |
| 125 |
#pragma omp teams thread_limit(1, 2, 3) // expected-error {{only one expression allowed in 'thread_limit' clause}} |
| 126 |
foo(); |
| 127 |
|
| 128 |
return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}} |
| 129 |
} |