112a9d9c8Sopenharmony_ci// bindgen-flags: -- -std=c++14
212a9d9c8Sopenharmony_ci
312a9d9c8Sopenharmony_ci// Small test that we handle virtual tables correctly when deriving from a
412a9d9c8Sopenharmony_ci// template instantiation. This wasn't previously handled at all. Note that when
512a9d9c8Sopenharmony_ci// inheriting from a template parameter, the type that is instantiated might or
612a9d9c8Sopenharmony_ci// might not have a virtual table, and we have no way of knowing. We don't
712a9d9c8Sopenharmony_ci// handle that yet, so no test for it here.
812a9d9c8Sopenharmony_ci
912a9d9c8Sopenharmony_ci/// This should have an explicit vtable.
1012a9d9c8Sopenharmony_citemplate<class T>
1112a9d9c8Sopenharmony_ciclass BaseWithVtable {
1212a9d9c8Sopenharmony_ci    T t;
1312a9d9c8Sopenharmony_ci
1412a9d9c8Sopenharmony_ci    virtual void hello();
1512a9d9c8Sopenharmony_ci};
1612a9d9c8Sopenharmony_ci
1712a9d9c8Sopenharmony_ci/// This should not have an explicit vtable.
1812a9d9c8Sopenharmony_ciclass DerivedWithNoVirtualMethods : public BaseWithVtable<char*> {};
1912a9d9c8Sopenharmony_ci
2012a9d9c8Sopenharmony_ci/// This should not have an explicit vtable.
2112a9d9c8Sopenharmony_ciclass DerivedWithVirtualMethods : public BaseWithVtable<char*> {
2212a9d9c8Sopenharmony_ci    virtual void zoidberg();
2312a9d9c8Sopenharmony_ci};
2412a9d9c8Sopenharmony_ci
2512a9d9c8Sopenharmony_ci/// This should not have any vtable.
2612a9d9c8Sopenharmony_citemplate<class U>
2712a9d9c8Sopenharmony_ciclass BaseWithoutVtable {
2812a9d9c8Sopenharmony_ci    U u;
2912a9d9c8Sopenharmony_ci};
3012a9d9c8Sopenharmony_ci
3112a9d9c8Sopenharmony_ci/// This should have an explicit vtable.
3212a9d9c8Sopenharmony_ciclass DerivedWithVtable : public BaseWithoutVtable<char*> {
3312a9d9c8Sopenharmony_ci    virtual void leela();
3412a9d9c8Sopenharmony_ci};
3512a9d9c8Sopenharmony_ci
3612a9d9c8Sopenharmony_ci/// This should not have any vtable.
3712a9d9c8Sopenharmony_ciclass DerivedWithoutVtable : public BaseWithoutVtable<char*> {};
38