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