• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // bindgen-flags: -- -std=c++14
2 
3 // Small test that we handle virtual tables correctly when deriving from a
4 // template instantiation. This wasn't previously handled at all. Note that when
5 // inheriting from a template parameter, the type that is instantiated might or
6 // might not have a virtual table, and we have no way of knowing. We don't
7 // handle that yet, so no test for it here.
8 
9 /// This should have an explicit vtable.
10 template<class T>
11 class BaseWithVtable {
12     T t;
13 
14     virtual void hello();
15 };
16 
17 /// This should not have an explicit vtable.
18 class DerivedWithNoVirtualMethods : public BaseWithVtable<char*> {};
19 
20 /// This should not have an explicit vtable.
21 class DerivedWithVirtualMethods : public BaseWithVtable<char*> {
22     virtual void zoidberg();
23 };
24 
25 /// This should not have any vtable.
26 template<class U>
27 class BaseWithoutVtable {
28     U u;
29 };
30 
31 /// This should have an explicit vtable.
32 class DerivedWithVtable : public BaseWithoutVtable<char*> {
33     virtual void leela();
34 };
35 
36 /// This should not have any vtable.
37 class DerivedWithoutVtable : public BaseWithoutVtable<char*> {};
38