Skip to content

Commit

Permalink
🐛 [type_name] fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-jusiak committed Mar 9, 2024
1 parent 24e03a0 commit ead9af9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/boost/sml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,13 @@ auto get_type_name(const char *ptr, index_sequence<Ns...>) {
template <class T>
const char *get_type_name() {
#if defined(_MSC_VER) && !defined(__clang__)
return detail::get_type_name<T, 39>(__FUNCSIG__, make_index_sequence<sizeof(__FUNCSIG__) - 39 - 8>{});
return detail::get_type_name<T, 65>(__FUNCSIG__, make_index_sequence<sizeof(__FUNCSIG__) - 65 - 8>{});
#elif defined(__clang__) && (__clang_major__ >= 12)
return detail::get_type_name<T, 50>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 50 - 2>{});
#elif defined(__clang__)
return detail::get_type_name<T, 63>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 63 - 2>{});
#elif defined(__GNUC__)
return detail::get_type_name<T, 68>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 68 - 2>{});
return detail::get_type_name<T, 69>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 69 - 2>{});
#endif
}
#if defined(__cpp_nontype_template_parameter_class) || \
Expand Down
7 changes: 7 additions & 0 deletions test/ut/type_traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <string>

#include "boost/sml.hpp"

BOOST_SML_NAMESPACE_BEGIN
Expand Down Expand Up @@ -67,5 +69,10 @@ test is_empty_type = [] {
static_expect(!is_empty<non_empty>::value);
};

test type_name = [] {
expect(std::string("int") == get_type_name<int>());
expect(std::string("void") == get_type_name<void>());
};

} // namespace aux
BOOST_SML_NAMESPACE_END

0 comments on commit ead9af9

Please sign in to comment.