summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.bugs/900321_02.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.bugs/900321_02.C')
-rwxr-xr-xgcc/testsuite/g++.old-deja/g++.bugs/900321_02.C27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900321_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900321_02.C
new file mode 100755
index 0000000..d635ba3
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.bugs/900321_02.C
@@ -0,0 +1,27 @@
+// g++ 1.37.1 bug 900321_02
+
+// The following program exits with a non-zero status because the constructor
+// is not called 3 times as it should be. This program exits with a zero
+// status when compiled with cfront 2.0.
+
+// Cfront 2.0 passes this test.
+
+// keywords: arrays, initialization, default constructor, operator new
+
+int call_count = 0;
+
+struct struct0 {
+ struct0 ();
+};
+
+struct0::struct0 () { call_count++; }
+
+typedef struct0 array[3]; // known dimension
+
+int test ()
+{
+ new array;
+ return (call_count != 3);
+}
+
+int main () { return test (); }