[gcn] install.texi: Update for new ISA targets and their requirements
[gcc.git] / gcc / testsuite / g++.dg / cpp23 / label1.C
blob14657652f4a1b743ec1235158d2ac8f9eed30b8b
1 // P2324R2 - Labels at the end of compound statements
2 // PR c++/103539
3 // { dg-do compile }
4 // Test good cases.
6 void
7 p2324 ()
9 first:
10   int x; 
11 second:
12   x = 1;
13 last:
14 } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
16 void
17 fn1 ()
19   l1:
20 } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
22 void
23 fn2 ()
25   if (1)
26     {
27 l1:
28     } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
31 void
32 fn3 ()
34   {
35     {
36 label:
37     } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
38   }
41 void
42 fn4 ()
44   switch (1)
45     {
46 lab:
47     } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
50 void
51 fn5 ()
53 l1:
54 l2:
55 l3:
56 } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
58 void
59 fn6 ()
61   ;
62 l1:
63 l2:
64 l3:
65 } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
68 #if __cplusplus >= 201103L
69 void
70 fn7 ()
72   auto l = [](){
73     lab:
74   }; // { dg-error "label at end of compound statement only available with" "" { target { c++20_down && c++11 } } }
76 #endif
78 void
79 fn8 ()
81   try
82     {
83 lab1:
84     } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
85   catch (int)
86     {
87 lab2:
88     } // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }