From a5cbddc466adff5c531f643e082d43bd7d3c9dc3 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 29 Sep 2021 21:09:19 +0300 Subject: [PATCH] Add test for enums --- include/boost/core/type_name.hpp | 5 +++++ test/type_name_test.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index edd3dd2..c3fdbc4 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -89,6 +89,11 @@ template std::string typeid_name() r = r.substr( 7 ); } + if( r.substr( 0, 5 ) == "enum " ) + { + r = r.substr( 5 ); + } + #endif // libc++ inline namespace diff --git a/test/type_name_test.cpp b/test/type_name_test.cpp index cd42f62..b0a1b8f 100644 --- a/test/type_name_test.cpp +++ b/test/type_name_test.cpp @@ -42,6 +42,11 @@ template struct X { }; +enum E +{ + e1 +}; + int main() { TEST(int); @@ -49,6 +54,8 @@ int main() TEST(A); TEST(B); + TEST(E); + TEST(A const); TEST(A volatile); TEST(A const volatile);