Skip to content

Commit adfb601

Browse files
committed
🐛 [type_name] fixup
1 parent 24e03a0 commit adfb601

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

include/boost/sml.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,13 +581,13 @@ auto get_type_name(const char *ptr, index_sequence<Ns...>) {
581581
template <class T>
582582
const char *get_type_name() {
583583
#if defined(_MSC_VER) && !defined(__clang__)
584-
return detail::get_type_name<T, 39>(__FUNCSIG__, make_index_sequence<sizeof(__FUNCSIG__) - 39 - 8>{});
584+
return detail::get_type_name<T, 65>(__FUNCSIG__, make_index_sequence<sizeof(__FUNCSIG__) - 65 - 8>{});
585585
#elif defined(__clang__) && (__clang_major__ >= 12)
586586
return detail::get_type_name<T, 50>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 50 - 2>{});
587587
#elif defined(__clang__)
588588
return detail::get_type_name<T, 63>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 63 - 2>{});
589589
#elif defined(__GNUC__)
590-
return detail::get_type_name<T, 68>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 68 - 2>{});
590+
return detail::get_type_name<T, 69>(__PRETTY_FUNCTION__, make_index_sequence<sizeof(__PRETTY_FUNCTION__) - 69 - 2>{});
591591
#endif
592592
}
593593
#if defined(__cpp_nontype_template_parameter_class) || \

test/ut/type_traits.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77
//
8+
#include <string>
9+
810
#include "boost/sml.hpp"
911

1012
BOOST_SML_NAMESPACE_BEGIN
@@ -67,5 +69,10 @@ test is_empty_type = [] {
6769
static_expect(!is_empty<non_empty>::value);
6870
};
6971

72+
test type_name = [] {
73+
expect(std::string("int") == get_type_name<int>());
74+
expect(std::string("void") == get_type_name<void>());
75+
};
76+
7077
} // namespace aux
7178
BOOST_SML_NAMESPACE_END

0 commit comments

Comments
 (0)