diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/lto/20080904_0.C')
-rw-r--r-- | gcc/testsuite/g++.dg/lto/20080904_0.C | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lto/20080904_0.C b/gcc/testsuite/g++.dg/lto/20080904_0.C new file mode 100644 index 00000000000..0161a00be7f --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080904_0.C @@ -0,0 +1,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; +} |