Properly detect destructor with template specialization