aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2002-01-18 08:25:27 -0500
committerJason Merrill <jason@gcc.gnu.org>2002-01-18 08:25:27 -0500
commite73c8e753ce1e1e4909618ed66e69cbe8a3c2cfc (patch)
tree345f2a7bf6589ade056567f572d7389574dbdb6b /gcc
parentcc0723165e7aa03d4f07f542452ca7cbb7912d69 (diff)
downloadgcc-e73c8e753ce1e1e4909618ed66e69cbe8a3c2cfc.zip
gcc-e73c8e753ce1e1e4909618ed66e69cbe8a3c2cfc.tar.gz
gcc-e73c8e753ce1e1e4909618ed66e69cbe8a3c2cfc.tar.bz2
semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER if we're in a template.
* semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER if we're in a template. From-SVN: r48985
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/template/vtable1.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/vtable1.C b/gcc/testsuite/g++.dg/template/vtable1.C
new file mode 100644
index 0000000..c5f122a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/vtable1.C
@@ -0,0 +1,23 @@
+// Test that vtables are set up properly for constructors and destructors
+// of template classes.
+
+// { dg-do run }
+
+int r;
+
+template <class T>
+struct A {
+ virtual void f () { }
+ A() { f (); }
+ ~A() { f (); }
+};
+
+struct B : public A<int> {
+ virtual void f () { ++r; }
+};
+
+int main ()
+{
+ { B b; }
+ return r;
+}