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
|
@ -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