OSDN Git Service

* g++.dg/init/dtor1.C: New test.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 May 2002 05:14:31 +0000 (05:14 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 May 2002 05:14:31 +0000 (05:14 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53033 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/dtor1.C [new file with mode: 0644]

index e12dc07..d24d0e4 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/init/dtor1.C: New test.
+
 2002-05-02  Aldy Hernandez  <aldyh@redhat.com>
 
         * gcc.dg/altivec-8.c: New.
 2002-05-02  Aldy Hernandez  <aldyh@redhat.com>
 
         * gcc.dg/altivec-8.c: New.
diff --git a/gcc/testsuite/g++.dg/init/dtor1.C b/gcc/testsuite/g++.dg/init/dtor1.C
new file mode 100644 (file)
index 0000000..3a48bcd
--- /dev/null
@@ -0,0 +1,27 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+int d = 2;
+
+struct B
+{
+  int x;
+  B (int i) : x (i) { }
+  ~B () { if (d-- != x) abort (); }
+};
+
+struct A
+  : public B
+{
+  A () : B (0), x1(1), x2(2) {}
+  B x1;
+  B x2;
+};
+
+
+int main ()
+{
+  A a;
+  return 0;
+}