mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-10 10:27:05 +08:00
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
This commit is contained in:
parent
cc0723165e
commit
e73c8e753c
23
gcc/testsuite/g++.dg/template/vtable1.C
Normal file
23
gcc/testsuite/g++.dg/template/vtable1.C
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user