blob: 55864a0cf0f459a0ade6ffb3cfafe8cbced77396 (
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
|
/* PERMUTE_ARGS: -O
*/
// https://issues.dlang.org/show_bug.cgi?id=22104
struct S { int a1, a2, a3; }
version (none)
void throws2ndCall(ref S x);
else
{
void throws2ndCall(ref S x)
{
__gshared bool b;
if (b)
throw new Exception("n == 1");
b = true;
}
}
void main() { foo(); }
void foo()
{
S[] arr = [S(), S()];
size_t i;
try
{
for (i = 0; i < 2; i++)
throws2ndCall(arr[i]);
}
catch (Exception o)
{
//printf("Exception: i = %lu\n", i);
assert(i == 1); // this fails
}
}
|