gcc/testsuite/g++.old-deja/g++.law/temps3.C
raw| 1 | // { dg-do run } |
| 2 | // GROUPS passed temps |
| 3 | // temps file |
| 4 | // Message-Id: <[email protected]> |
| 5 | // From: [email protected] (Stephane CHATTY) |
| 6 | // Subject: g++ 2.4.5 does not destroy temporaries |
| 7 | // Date: Mon, 23 Aug 93 17:35:34 +0200 |
| 8 | |
| 9 | #include <stdio.h> |
| 10 | |
| 11 | class A { |
| 12 | public: |
| 13 | int a; |
| 14 | A (int i) : a (i) { ;} |
| 15 | A (const A& aa) : a (aa.a) { ;} |
| 16 | ~A () { printf ("PASS\n");; } |
| 17 | }; |
| 18 | |
| 19 | A |
| 20 | foo () |
| 21 | { |
| 22 | return A (10); |
| 23 | } |
| 24 | |
| 25 | int main () |
| 26 | { |
| 27 | int x = foo ().a; |
| 28 | } |
| 29 |