#include "boost/type_traits/is_base_of.hpp" template<class T> struct B { static int _error[boost::is_base_of<B,T>::value ? 1 : -1]; //error C2118: negative subscript }; struct A : B<A> {};