116 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 100 -o - %s -Wuninitialized4 5void 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;17 T z;18#pragma omp target19#pragma omp teams distribute num_teams(C)20 for (int i=0; i<100; i++) foo();21#pragma omp target22#pragma omp teams distribute num_teams(T) // expected-error {{'T' does not refer to a value}}23 for (int i=0; i<100; i++) foo();24#pragma omp target25#pragma omp teams distribute num_teams // expected-error {{expected '(' after 'num_teams'}}26 for (int i=0; i<100; i++) foo();27#pragma omp target28#pragma omp teams distribute num_teams( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}29 for (int i=0; i<100; i++) foo();30#pragma omp target31#pragma omp teams distribute num_teams() // expected-error {{expected expression}}32 for (int i=0; i<100; i++) foo();33#pragma omp target34#pragma omp teams distribute num_teams(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}35 for (int i=0; i<100; i++) foo();36#pragma omp target37#pragma omp teams distribute num_teams(argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute' are ignored}}38 for (int i=0; i<100; i++) foo();39#pragma omp target40#pragma omp teams distribute num_teams(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}41 for (int i=0; i<100; i++) foo();42#pragma omp target43#pragma omp teams distribute num_teams(argc + argc + z)44 for (int i=0; i<100; i++) foo();45#pragma omp target46#pragma omp teams distribute num_teams(argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams distribute' cannot contain more than one 'num_teams' clause}}47 for (int i=0; i<100; i++) foo();48#pragma omp target49#pragma omp teams distribute num_teams(S1) // expected-error {{'S1' does not refer to a value}}50 for (int i=0; i<100; i++) foo();51#pragma omp target52#pragma omp teams distribute num_teams(-2) // expected-error {{argument to 'num_teams' clause must be a strictly positive integer value}}53 for (int i=0; i<100; i++) foo();54#pragma omp target55#pragma omp teams distribute num_teams(-10u)56 for (int i=0; i<100; i++) foo();57#pragma omp target58#pragma omp teams distribute num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}59 for (int i=0; i<100; i++) foo();60 61 return 0;62}63 64int main(int argc, char **argv) {65 int z;66#pragma omp target67#pragma omp teams distribute num_teams // expected-error {{expected '(' after 'num_teams'}}68 for (int i=0; i<100; i++) foo();69 70#pragma omp target71#pragma omp teams distribute num_teams ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}72 for (int i=0; i<100; i++) foo();73 74#pragma omp target75#pragma omp teams distribute num_teams () // expected-error {{expected expression}}76 for (int i=0; i<100; i++) foo();77 78#pragma omp target79#pragma omp teams distribute num_teams (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}80 for (int i=0; i<100; i++) foo();81 82#pragma omp target83#pragma omp teams distribute num_teams (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute' are ignored}}84 for (int i=0; i<100; i++) foo();85 86#pragma omp target87#pragma omp teams distribute num_teams (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}88 for (int i=0; i<100; i++) foo();89 90#pragma omp target91#pragma omp teams distribute num_teams (argc + argc + z)92 for (int i=0; i<100; i++) foo();93 94#pragma omp target95#pragma omp teams distribute num_teams (argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams distribute' cannot contain more than one 'num_teams' clause}}96 for (int i=0; i<100; i++) foo();97 98#pragma omp target99#pragma omp teams distribute num_teams (S1) // expected-error {{'S1' does not refer to a value}}100 for (int i=0; i<100; i++) foo();101 102#pragma omp target103#pragma omp teams distribute num_teams (-2) // expected-error {{argument to 'num_teams' clause must be a strictly positive integer value}}104 for (int i=0; i<100; i++) foo();105 106#pragma omp target107#pragma omp teams distribute num_teams (-10u)108 for (int i=0; i<100; i++) foo();109 110#pragma omp target111#pragma omp teams distribute num_teams (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}112 for (int i=0; i<100; i++) foo();113 114 return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}}115}116