...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
The enclosing type you introspect with TTI must be a valid type at the point in which you invoke the macro metafunction. If it is not a valid type at that point you will receive a compiler error.
If the enclosing type is a valid type but is not a class type you will not receive a compiler error, but the result of the introspection will always return 'false' or, in the case of the metafunction generated by BOOST_TTI_MEMBER_TYPE, will always return the marker type.
When using the macro metafunctions generated by BOOST_TTI_HAS_MEMBER_DATA and BOOST_TTI_HAS_MEMBER_FUNCTION the first template parameter may be an enclosing type or a pointer to member data or member function respectively. In each of these cases TTI can distinguish between the two possibilities and only if the first template parameter is an enclosing type, once again if it is a valid type but not a class type you will not receive a compiler error but the result of the introspection will return 'false'.