aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C
blob: a9de4838ca11eb836d996578a6a135dfadf7119a (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
30
31
32
33
// GROUPS passed code-generation
// execution test - XFAIL *-*-*
// code-gen file
// From: mscha@anne.wifo.uni-mannheim.de (Martin Schader)
// Date:     Wed, 4 Aug 93 19:14:52 +0200
// Message-ID: <9308041714.AA00752@anne.wifo.uni-mannheim.de>

extern "C" int printf (const char *, ...);

template<class T> struct Y {
    Y* next;
};

template<class T> struct X {
    X() { ptrY = 0; }
    void f();
    Y<T>* ptrY;
};

template<class T> void X<T>::f() {
    ptrY->next = ptrY = new Y<T>;
//
//  Use two assignment statements and it works
//    ptrY = new Y<T>;
//    ptrY->next = ptrY;
}

int main() {
    X<int> x;
    x.f();
    printf ("PASS\n");
    exit(0);
}