summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/temps3.C
blob: 401b00661c035db0b4f5949a0a2a1582d73d7f56 (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
// { dg-do run  }
// GROUPS passed temps
// temps file
// Message-Id: <9308231535.AA19432@geant.cenatls.cena.dgac.fr>
// From: chatty@geant.cenatls.cena.dgac.fr (Stephane CHATTY)
// Subject: g++ 2.4.5 does not destroy temporaries
// Date: Mon, 23 Aug 93 17:35:34 +0200

#include <stdio.h>

class A {
public:
        int a;
        A (int i) : a (i) { ;}
        A (const A& aa) : a (aa.a) { ;}
        ~A () { printf ("PASS\n");; }
};

A
foo ()
{
        return A (10);
}

int main ()
{
        int x = foo ().a;
}