2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / ref7.C
bloba7a7f8cd5d0e5643bc6bda0feeb56eb2ad3ea5cd
1 // { dg-do run  }
2 // Testcase for the lifetime of a temporary object which is used to
3 // initialize a reference.
5 int destroyed = 0;
7 struct A {
8   A() { }
9   A(int) { }
10   ~A() { destroyed++; }
13 A a;
14 A foo () { return a; }
16 int main()
18   const A& ar = foo();
19   const A& ar2 = A();
20   const A& ar3 = (A)1;
21   return destroyed;