template struct B { void f(T *p) { p->template A::~A(); p->A::~A(); p->~A(); p->~A(); p->~T(); p->T::~T(); } }; template struct A { }; int main() { B >().f(0); }