blob: 624e0535941d05d58d81251042a78e7170963d15 (
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
|
// PR c++/86769
// { dg-do run { target c++11 } }
int v;
struct S {
int s;
S (int x) : s(x)
{
if ((v != 0 || s != 0) && (v != 3 || s != 1))
__builtin_abort ();
++v;
}
~S ()
{
if ((v != 2 || s != 0) && (v != 4 || s != 1))
__builtin_abort ();
++v;
}
operator bool () const { return true; }
};
void
foo (const S &s)
{
if (v != 1 || s.s != 0)
__builtin_abort ();
++v;
}
int
main ()
{
for (int i = 0; S j{i}; foo (j))
{
if (++i == 2)
break;
}
}
|