repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Rebase.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
init
/
for1.C
blob
420e85cff6964b2cc85f77957dcf51ed1798b0aa
1
// PR c++/13865
2
// Bug: We were destroying 'a' before executing the loop.
3
4
// { dg-do run }
5
6
#include <stdio.h>
7
8
int i;
9
int r;
10
11
class A
12
{
13
public:
14
A() { printf("A ctor\n"); }
15
~A()
16
{
17
printf("A dtor\n");
18
if (i != 2)
19
r = 1;
20
}
21
};
22
23
int main(int argc, char **argv)
24
{
25
for (A a; i < 2; ++i) {
26
printf("iteration %d\n", i);
27
}
28
29
return r;
30
}