67 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized2 3// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized4 5void foo() {6}7 8bool foobool(int argc) {9 return argc;10}11 12struct S1; // expected-note {{declared here}} expected-note {{declared here}}13 14template <class T, int N>15T tmain(T argc) {16 T b = argc, c, d, e, f, g;17 char ** argv;18 static T a;19 T z;20 #pragma omp distribute dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}21 for (int i = 0; i < 10; ++i) foo();22 #pragma omp distribute dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}23 for (int i = 0; i < 10; ++i) foo();24 #pragma omp distribute dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}25 for (int i = 0; i < 10; ++i) foo();26 #pragma omp distribute dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}27 for (int i = 0; i < 10; ++i) foo();28 #pragma omp distribute dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}29 for (int i = 0; i < 10; ++i) foo();30 #pragma omp distribute dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute' are ignored}}31 for (int i = 0; i < 10; ++i) foo();32 #pragma omp distribute dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}}33 for (int i = 0; i < 10; ++i) foo();34 #pragma omp distribute dist_schedule (static), dist_schedule (static, 1 + z) // expected-error {{directive '#pragma omp distribute' cannot contain more than one 'dist_schedule' clause}}35 for (int i = 0; i < 10; ++i) foo();36 #pragma omp distribute dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}37 for (int i = 0; i < 10; ++i) foo();38 #pragma omp distribute dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}39 for (int i = 0; i < 10; ++i) foo();40 return T();41}42 43int main(int argc, char **argv) {44int z;45 #pragma omp distribute dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}46 for (int i = 0; i < 10; ++i) foo();47 #pragma omp distribute dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}48 for (int i = 0; i < 10; ++i) foo();49 #pragma omp distribute dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}50 for (int i = 0; i < 10; ++i) foo();51 #pragma omp distribute dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}52 for (int i = 0; i < 10; ++i) foo();53 #pragma omp distribute dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}54 for (int i = 0; i < 10; ++i) foo();55 #pragma omp distribute dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute' are ignored}}56 for (int i = 0; i < 10; ++i) foo();57 #pragma omp distribute dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}58 for (int i = 0; i < 10; ++i) foo();59 #pragma omp distribute dist_schedule (static), dist_schedule (static, 1 -z ) // expected-error {{directive '#pragma omp distribute' cannot contain more than one 'dist_schedule' clause}}60 for (int i = 0; i < 10; ++i) foo();61 #pragma omp distribute dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}62 for (int i = 0; i < 10; ++i) foo();63 #pragma omp distribute dist_schedule (static, argv[1]=2) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} expected-error {{expected ')'}} expected-note {{to match this '('}}64 for (int i = 0; i < 10; ++i) foo();65 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}66}67