summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/virtual4.C
blob: 0cbd23c366ca8831217b5907a6480cf8590b9fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// { dg-do run  }
// Origin: Mark Mitchell <mark@codesourcery.com>

struct B 
{
  B ();
  virtual void f () = 0;
};

B::B () 
{
}

extern B* bp;

template <class T>
struct C : public B
{
  virtual void f () 
    {
    }
};

template <class T>
struct D : public B
{
  virtual void f () 
    {
      bp = new C<T*>;
    }
};

B* bp = new D<int>;

int main ()
{
  bp->f ();
  bp->f ();
}