]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/target_teams_thread_limit_messages.cpp
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / OpenMP / target_teams_thread_limit_messages.cpp
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 teams thread_limit(C)
16   foo();
17 #pragma omp target teams thread_limit(T) // expected-error {{'T' does not refer to a value}}
18   foo();
19 #pragma omp target teams thread_limit // expected-error {{expected '(' after 'thread_limit'}}
20   foo();
21 #pragma omp target teams thread_limit( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
22   foo();
23 #pragma omp target teams thread_limit() // expected-error {{expected expression}}
24   foo();
25 #pragma omp target teams thread_limit(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
26   foo();
27 #pragma omp target teams thread_limit(argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}}
28   foo();
29 #pragma omp target teams thread_limit(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
30   foo();
31 #pragma omp target teams thread_limit(argc + argc)
32   foo();
33 #pragma omp target teams thread_limit(argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'thread_limit' clause}}
34   foo();
35 #pragma omp target teams thread_limit(S1) // expected-error {{'S1' does not refer to a value}}
36   foo();
37 #pragma omp target teams thread_limit(-2) // expected-error {{argument to 'thread_limit' clause must be a strictly positive integer value}}
38   foo();
39 #pragma omp target teams thread_limit(-10u)
40   foo();
41 #pragma omp target teams thread_limit(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}}
42   foo();
43
44   return 0;
45 }
46
47 int main(int argc, char **argv) {
48 #pragma omp target teams thread_limit // expected-error {{expected '(' after 'thread_limit'}}
49   foo();
50
51 #pragma omp target teams thread_limit ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
52   foo();
53
54 #pragma omp target teams thread_limit () // expected-error {{expected expression}}
55   foo();
56
57 #pragma omp target teams thread_limit (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
58   foo();
59
60 #pragma omp target teams thread_limit (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}}
61   foo();
62
63 #pragma omp target teams thread_limit (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
64   foo();
65
66 #pragma omp target teams thread_limit (argc + argc)
67   foo();
68
69 #pragma omp target teams thread_limit (argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'thread_limit' clause}}
70   foo();
71
72 #pragma omp target teams thread_limit (S1) // expected-error {{'S1' does not refer to a value}}
73   foo();
74
75 #pragma omp target teams thread_limit (-2) // expected-error {{argument to 'thread_limit' clause must be a strictly positive integer value}}
76   foo();
77
78 #pragma omp target teams thread_limit (-10u)
79   foo();
80
81 #pragma omp target teams thread_limit (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}}
82   foo();
83
84   return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}}
85 }