aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.law/code-gen3.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/code-gen3.C33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C b/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C
new file mode 100644
index 00000000000..0635d278197
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C
@@ -0,0 +1,33 @@
+// GROUPS passed code-generation
+// execution test fails -
+// 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);
+}