fix build
This commit is contained in:
parent
ddc79d8d3e
commit
2a118da028
2 changed files with 22 additions and 13 deletions
|
@ -435,12 +435,18 @@ constexpr cstring Nameof(const char* name, std::size_t size, bool with_suffix =
|
||||||
template <typename T,
|
template <typename T,
|
||||||
typename = typename std::enable_if<!std::is_reference<T>::value && std::is_enum<T>::value>::type>
|
typename = typename std::enable_if<!std::is_reference<T>::value && std::is_enum<T>::value>::type>
|
||||||
constexpr cstring NameofEnum(T value) {
|
constexpr cstring NameofEnum(T value) {
|
||||||
|
#if defined(__clang__) || defined(_MSC_VER)
|
||||||
return detail::NameofPretty(detail::NameofEnumImpl<T>{}(value), false);
|
return detail::NameofPretty(detail::NameofEnumImpl<T>{}(value), false);
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
return detail::NameofEnumImpl<T>{}(value);
|
||||||
|
#else
|
||||||
|
return {};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
NAMEOF_TYPE_CONSTEXPR cstring NameofType() {
|
NAMEOF_TYPE_CONSTEXPR cstring NameofType() {
|
||||||
return true ? detail::NameofType<detail::nstd::identity<T>>() : detail::NameofType<detail::nstd::identity<T>>();
|
return detail::NameofType<detail::nstd::identity<T>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -151,8 +151,7 @@ TEST_CASE("constexpr") {
|
||||||
static_assert(cx == "RED", "");
|
static_assert(cx == "RED", "");
|
||||||
REQUIRE(cx == "RED");
|
REQUIRE(cx == "RED");
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
//static_assert(cx == "(Color)0", "");
|
REQUIRE(cx == "(const Color)0");
|
||||||
REQUIRE(cx == "(Color)0");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,10 +314,10 @@ TEST_CASE("NAMEOF_ENUM") {
|
||||||
REQUIRE(NAMEOF_ENUM(directions) == "Right");
|
REQUIRE(NAMEOF_ENUM(directions) == "Right");
|
||||||
# elif defined(__GNUC__)
|
# elif defined(__GNUC__)
|
||||||
REQUIRE(NAMEOF_ENUM(Color::RED) == "(Color)0");
|
REQUIRE(NAMEOF_ENUM(Color::RED) == "(Color)0");
|
||||||
REQUIRE(NAMEOF_ENUM(color) == "0");
|
REQUIRE(NAMEOF_ENUM(color) == "(const Color)0");
|
||||||
|
|
||||||
REQUIRE(NAMEOF_ENUM(Directions::Right) == "2");
|
REQUIRE(NAMEOF_ENUM(Directions::Right) == "(Directions)2");
|
||||||
REQUIRE(NAMEOF_ENUM(directions) == "2");
|
REQUIRE(NAMEOF_ENUM(directions) == "(const Directions)2");
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,9 +427,11 @@ TEST_CASE("Spaces and Tabs ignored") {
|
||||||
REQUIRE(NAMEOF( struct_var ) == "struct_var");
|
REQUIRE(NAMEOF( struct_var ) == "struct_var");
|
||||||
REQUIRE(NAMEOF_FULL( struct_var ) == "struct_var");
|
REQUIRE(NAMEOF_FULL( struct_var ) == "struct_var");
|
||||||
REQUIRE(NAMEOF_RAW( struct_var ) == "struct_var");
|
REQUIRE(NAMEOF_RAW( struct_var ) == "struct_var");
|
||||||
|
#if defined(__clang__) || defined(_MSC_VER)
|
||||||
REQUIRE(NAMEOF_ENUM( color ) == "RED");
|
REQUIRE(NAMEOF_ENUM( color ) == "RED");
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
REQUIRE(NAMEOF_ENUM( color ) == "(const Color)0");
|
||||||
|
#endif
|
||||||
REQUIRE(NAMEOF_TYPE( struct_var ) == "SomeStruct");
|
REQUIRE(NAMEOF_TYPE( struct_var ) == "SomeStruct");
|
||||||
REQUIRE(NAMEOF_TYPE_T( decltype(struct_var) ) == "SomeStruct");
|
REQUIRE(NAMEOF_TYPE_T( decltype(struct_var) ) == "SomeStruct");
|
||||||
}
|
}
|
||||||
|
@ -439,9 +440,11 @@ TEST_CASE("Spaces and Tabs ignored") {
|
||||||
REQUIRE(NAMEOF( struct_var ) == "struct_var");
|
REQUIRE(NAMEOF( struct_var ) == "struct_var");
|
||||||
REQUIRE(NAMEOF_FULL( struct_var ) == "struct_var");
|
REQUIRE(NAMEOF_FULL( struct_var ) == "struct_var");
|
||||||
REQUIRE(NAMEOF_RAW( struct_var ) == "struct_var");
|
REQUIRE(NAMEOF_RAW( struct_var ) == "struct_var");
|
||||||
|
#if defined(__clang__) || defined(_MSC_VER)
|
||||||
REQUIRE(NAMEOF_ENUM( color ) == "RED");
|
REQUIRE(NAMEOF_ENUM( color ) == "RED");
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
REQUIRE(NAMEOF_ENUM( color ) == "(const Color)0");
|
||||||
|
#endif
|
||||||
REQUIRE(NAMEOF_TYPE( struct_var ) == "SomeStruct");
|
REQUIRE(NAMEOF_TYPE( struct_var ) == "SomeStruct");
|
||||||
REQUIRE(NAMEOF_TYPE_T( decltype(struct_var) ) == "SomeStruct");
|
REQUIRE(NAMEOF_TYPE_T( decltype(struct_var) ) == "SomeStruct");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue