Hi,
I suggest the following solution:
============================================================
template<class F>
void testEnum(const F & f)
{
BOOST_STATIC_ASSERT(!boost::is_enum<boost::function_traits<boost::remove_pointer<F>::type >::result_type >::value);
}
template <typename ContractType>
class C {
private:
static void verify()
{
testEnum(&ContractType::st1);
testEnum(&ContractType::st2);
}
public:
~C() { verify(); }
};
============================================================
The problem is "verify" function should be generated during compilation.
If class "C" contains only static functions then you will have to invoke "verify" from all of them, to guarantie that verify will be generated.
In other case it is enough to invoke "verify" from destructor.
Best Regards,
Sergei