From a267cc70d768238469bb0abcc4e2fd03d7bd4ad3 Mon Sep 17 00:00:00 2001 From: neargye Date: Tue, 27 Aug 2019 19:54:16 +0500 Subject: [PATCH] fix is_nameof_*_supported --- include/nameof.hpp | 4 ++-- test/test.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index 587beb0..5895adf 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -266,10 +266,10 @@ inline constexpr auto nameof_type_v = n(); } // namespace nameof::detail // Checks is nameof_type supported compiler. -inline constexpr auto is_nameof_type_supported = detail::nameof_type_supported::value; +inline constexpr bool is_nameof_type_supported = detail::nameof_type_supported::value; // Checks is nameof_enum supported compiler. -inline constexpr auto is_nameof_enum_supported = detail::nameof_enum_supported::value; +inline constexpr bool is_nameof_enum_supported = detail::nameof_enum_supported::value; // Obtains simple (unqualified) string enum name of enum variable. template diff --git a/test/test.cpp b/test/test.cpp index 78fedbb..fc9ca93 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -89,6 +89,14 @@ struct enum_range { }; } +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 9) || defined(_MSC_VER) +static_assert(nameof::is_nameof_enum_supported, "nameof::nameof_enum: Unsupported compiler (https://github.com/Neargye/nameof#compiler-compatibility)."); +#endif + +#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER) +static_assert(nameof::is_nameof_type_supported, "nameof::nameof_type: Unsupported compiler (https://github.com/Neargye/nameof#compiler-compatibility)."); +#endif + SomeStruct struct_var; Long othervar; SomeStruct * ptr_s = &struct_var;