From e73c8e753ce1e1e4909618ed66e69cbe8a3c2cfc Mon Sep 17 00:00:00 2001 From: Jason Merrill <jason@gcc.gnu.org> Date: Fri, 18 Jan 2002 08:25:27 -0500 Subject: [PATCH] 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 --- gcc/testsuite/g++.dg/template/vtable1.C | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/vtable1.C diff --git a/gcc/testsuite/g++.dg/template/vtable1.C b/gcc/testsuite/g++.dg/template/vtable1.C new file mode 100644 index 000000000000..c5f122adbd93 --- /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; +} -- GitLab