xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/ordered_messages.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc int foo();
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc template <class T>
foo()6*0a6a1f1dSLionel Sambuc T foo() {
7*0a6a1f1dSLionel Sambuc   #pragma omp for ordered
8*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
9*0a6a1f1dSLionel Sambuc     L1:
10*0a6a1f1dSLionel Sambuc       foo();
11*0a6a1f1dSLionel Sambuc     #pragma omp ordered
12*0a6a1f1dSLionel Sambuc     {
13*0a6a1f1dSLionel Sambuc       foo();
14*0a6a1f1dSLionel Sambuc       goto L1; // expected-error {{use of undeclared label 'L1'}}
15*0a6a1f1dSLionel Sambuc     }
16*0a6a1f1dSLionel Sambuc   }
17*0a6a1f1dSLionel Sambuc   #pragma omp for ordered
18*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
19*0a6a1f1dSLionel Sambuc     foo();
20*0a6a1f1dSLionel Sambuc     goto L2; // expected-error {{use of undeclared label 'L2'}}
21*0a6a1f1dSLionel Sambuc     #pragma omp ordered
22*0a6a1f1dSLionel Sambuc     {
23*0a6a1f1dSLionel Sambuc       L2:
24*0a6a1f1dSLionel Sambuc       foo();
25*0a6a1f1dSLionel Sambuc     }
26*0a6a1f1dSLionel Sambuc   }
27*0a6a1f1dSLionel Sambuc 
28*0a6a1f1dSLionel Sambuc   return T();
29*0a6a1f1dSLionel Sambuc }
30*0a6a1f1dSLionel Sambuc 
foo()31*0a6a1f1dSLionel Sambuc int foo() {
32*0a6a1f1dSLionel Sambuc   #pragma omp for ordered
33*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
34*0a6a1f1dSLionel Sambuc     L1:
35*0a6a1f1dSLionel Sambuc       foo();
36*0a6a1f1dSLionel Sambuc     #pragma omp ordered
37*0a6a1f1dSLionel Sambuc     {
38*0a6a1f1dSLionel Sambuc       foo();
39*0a6a1f1dSLionel Sambuc       goto L1; // expected-error {{use of undeclared label 'L1'}}
40*0a6a1f1dSLionel Sambuc     }
41*0a6a1f1dSLionel Sambuc   }
42*0a6a1f1dSLionel Sambuc   #pragma omp for ordered
43*0a6a1f1dSLionel Sambuc   for (int i = 0; i < 10; ++i) {
44*0a6a1f1dSLionel Sambuc     foo();
45*0a6a1f1dSLionel Sambuc     goto L2; // expected-error {{use of undeclared label 'L2'}}
46*0a6a1f1dSLionel Sambuc     #pragma omp ordered
47*0a6a1f1dSLionel Sambuc     {
48*0a6a1f1dSLionel Sambuc       L2:
49*0a6a1f1dSLionel Sambuc       foo();
50*0a6a1f1dSLionel Sambuc     }
51*0a6a1f1dSLionel Sambuc   }
52*0a6a1f1dSLionel Sambuc 
53*0a6a1f1dSLionel Sambuc   return foo<int>();
54*0a6a1f1dSLionel Sambuc }
55