OSDN Git Service

* thunk1.C: New test.
authoroliva <oliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Aug 1999 13:03:00 +0000 (13:03 +0000)
committeroliva <oliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Aug 1999 13:03:00 +0000 (13:03 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28858 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog
gcc/testsuite/g++.old-deja/g++.oliva/thunk1.C [new file with mode: 0644]

index 9ec7d6f..5a5ab8a 100644 (file)
@@ -1,3 +1,7 @@
+1999-08-25  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * thunk1.C: New test.
+
 1999-08-06  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * dwarf2.C, dwarf3.C: Added XFAIL for Solaris/x86.  Removed
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/thunk1.C b/gcc/testsuite/g++.old-deja/g++.oliva/thunk1.C
new file mode 100644 (file)
index 0000000..5407e9e
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+// based on bug report by Fredrik Öhrström <d92-foh@nada.kth.se>
+
+// Special g++ Options: -fvtable-thunks
+// execution test - XFAIL *-*-*
+
+#include <cstdlib>
+
+using namespace std;
+
+struct vbase {
+  virtual int get_a() const = 0;
+};
+
+struct base: virtual vbase {
+  int a;
+  base(int aa) : a(aa) {}
+  int get_a() const { return a; }
+};
+
+struct mid: base {
+  mid(int bb) : base(bb) {
+    // when mid is not in charge of vbase initialization,
+    // a derived-aware vtable is needed for vbase
+    if (((vbase*)this)->get_a() != bb)
+      abort();
+  }
+};
+
+struct derived: virtual mid {
+  derived(int cc) : mid(cc) {}
+};
+
+int main () {
+  derived(1);
+}