From: Jason Merrill Date: Fri, 18 Jan 2002 13:25:27 +0000 (-0500) Subject: semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER if we're in a template. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e73c8e753ce1e1e4909618ed66e69cbe8a3c2cfc;p=gcc.git 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 --- diff --git a/gcc/testsuite/g++.dg/template/vtable1.C b/gcc/testsuite/g++.dg/template/vtable1.C new file mode 100644 index 00000000000..c5f122adbd9 --- /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 +struct A { + virtual void f () { } + A() { f (); } + ~A() { f (); } +}; + +struct B : public A { + virtual void f () { ++r; } +}; + +int main () +{ + { B b; } + return r; +}