class Base
{
struct FooSecurity{};
};
template
class Foo
{
typename Type::FooSecurity If_You_Are_Reading_This_You_Tried_To_Create_An_Instance_Of_Foo_For_An_Invalid_Type;
};
Make sure derived classes inherit the FooSecurity structure and the compiler will get upset in all the right places.