mirror of
https://github.com/boostorg/type_index.git
synced 2025-08-02 05:44:28 +02:00
Add compile time error mesage when attempting to call RTTI only method under MSVC
This commit is contained in:
@@ -276,6 +276,9 @@ inline const type_info& type_id_with_cvr() BOOST_NOEXCEPT {
|
||||
/// producing a compile-time error with message: "boost::type_id_rtti_only(T&) requires RTTI"
|
||||
template <class T>
|
||||
inline const type_info& type_id_rtti_only(T& rtti_val) BOOST_NOEXCEPT {
|
||||
#ifdef BOOST_NO_RTTI
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(T) && false, "boost::type_id_rtti_only(T&) requires RTTI");
|
||||
#endif
|
||||
return static_cast<const type_info&>(typeid(rtti_val));
|
||||
}
|
||||
|
||||
@@ -284,6 +287,9 @@ inline const type_info& type_id_rtti_only(T& rtti_val) BOOST_NOEXCEPT {
|
||||
/// producing a compile-time error with message: "boost::type_id_rtti_only(T*) requires RTTI"
|
||||
template <class T>
|
||||
inline const type_info& type_id_rtti_only(T* rtti_val) {
|
||||
#ifdef BOOST_NO_RTTI
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(T) && false, "boost::type_id_rtti_only(T*) requires RTTI");
|
||||
#endif
|
||||
return static_cast<const type_info&>(typeid(rtti_val));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user