The problem is that BOOST_STATIC_ASSERT
is a macro, it resolves into a C++ construct, in which your this
keyword has different meaning.
To work this around you may try this:
struct blah
{
void func()
{
const size_t mySize = sizeof(*this);
BOOST_STATIC_ASSERT(mySize);
}
};