diff --git a/include/boost/hana/experimental/type_name.hpp b/include/boost/hana/experimental/type_name.hpp index e8b251db9..9d3df4dc3 100644 --- a/include/boost/hana/experimental/type_name.hpp +++ b/include/boost/hana/experimental/type_name.hpp @@ -26,18 +26,23 @@ namespace boost { namespace hana { namespace experimental { // Note: We substract the null terminator from the string sizes below. template - constexpr cstring type_name_impl2() { - - #if defined(__clang__) + constexpr auto type_name_impl2() { + #if defined(BOOST_HANA_CONFIG_CLANG) + constexpr char const* pretty_function = __PRETTY_FUNCTION__; + constexpr std::size_t total_size = sizeof(__PRETTY_FUNCTION__) - 1; + constexpr std::size_t prefix_size = sizeof("auto boost::hana::experimental::detail::type_name_impl2() [T = ") - 1; + constexpr std::size_t suffix_size = sizeof("]") - 1; + #elif defined(BOOST_HANA_CONFIG_GCC) constexpr char const* pretty_function = __PRETTY_FUNCTION__; constexpr std::size_t total_size = sizeof(__PRETTY_FUNCTION__) - 1; - constexpr std::size_t prefix_size = sizeof("cstring boost::hana::experimental::detail::type_name_impl2() [T = ") - 1; + constexpr std::size_t prefix_size = sizeof("constexpr auto boost::hana::experimental::detail::type_name_impl2() [with T = ") - 1; constexpr std::size_t suffix_size = sizeof("]") - 1; #else #error "No support for this compiler." #endif - return {pretty_function + prefix_size, total_size - prefix_size - suffix_size}; + cstring s{pretty_function + prefix_size, total_size - prefix_size - suffix_size}; + return s; } template