blob: 14657652f4a1b743ec1235158d2ac8f9eed30b8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// P2324R2 - Labels at the end of compound statements
// PR c++/103539
// { dg-do compile }
// Test good cases.
void
p2324 ()
{
first:
int x;
second:
x = 1;
last:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
void
fn1 ()
{
l1:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
void
fn2 ()
{
if (1)
{
l1:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
}
void
fn3 ()
{
{
{
label:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
}
}
void
fn4 ()
{
switch (1)
{
lab:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
}
void
fn5 ()
{
l1:
l2:
l3:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
void
fn6 ()
{
;
l1:
l2:
l3:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
#if __cplusplus >= 201103L
void
fn7 ()
{
auto l = [](){
lab:
}; // { dg-error "label at end of compound statement only available with" "" { target { c++20_down && c++11 } } }
}
#endif
void
fn8 ()
{
try
{
lab1:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
catch (int)
{
lab2:
} // { dg-error "label at end of compound statement only available with" "" { target c++20_down } }
}
|