OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.jason / ref7.C
1 // Testcase for the lifetime of a temporary object which is used to
2 // initialize a reference.
3
4 int destroyed = 0;
5
6 struct A {
7   A() { }
8   A(int) { }
9   ~A() { destroyed++; }
10 };
11
12 A a;
13 A foo () { return a; }
14
15 main()
16 {
17   const A& ar = foo();
18   const A& ar2 = A();
19   const A& ar3 = (A)1;
20   return destroyed;
21 }