summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/lto/20080904_0.C
blob: 0161a00be7f11903aa43f91faaa7d9b4422f2301 (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
// { dg-lto-do run }

/* This test will fail to link if the vtable for Derived is not emitted.  */

class Base {
public:
  Base(char *buf, unsigned len)
    : _buf(buf),
      _len(len)
  {}

  virtual int length () { return _len; }

private:
  char * _buf;
  unsigned _len;
};

class Derived : public Base {
public:
  Derived(char *buf, unsigned len)
    : Base(buf, len),
      _ctr(len)
  {}

  virtual int length () { return _ctr; }

private:
  unsigned _ctr;
};

int main ()
{
  Derived *d = new Derived (new char[256], 256);

  return 0;
}