fix build

This commit is contained in:
neargye 2021-04-03 00:29:27 +03:00
parent 2cf013dbf3
commit df0ea27383
2 changed files with 12 additions and 12 deletions

View file

@ -173,8 +173,8 @@ int main() {
std::cout << nameof::nameof_member<&SomeStruct::somefield>() << std::endl; // somefield std::cout << nameof::nameof_member<&SomeStruct::somefield>() << std::endl; // somefield
std::cout << nameof::nameof_member<&SomeStruct::SomeMethod1>() << std::endl; // SomeMethod1 std::cout << nameof::nameof_member<&SomeStruct::SomeMethod1>() << std::endl; // SomeMethod1
std::cout << NAMEOF_MEMBER(&Long::LL::field) << std::endl; // field std::cout << NAMEOF_MEMBER(&Long::LL::field) << std::endl; // field
constexpr auto member_ptr = &SomeStruct.somefield; constexpr auto member_ptr = &SomeStruct::somefield;
std::cout << NAMEOF_MEMBER(member_ptr) << std::endl; // field std::cout << NAMEOF_MEMBER(member_ptr) << std::endl; // somefield
#endif #endif
// Nameof macro. // Nameof macro.

View file

@ -883,19 +883,19 @@ TEST_CASE("NAMEOF_SHORT_TYPE_RTTI") {
#if defined(NAMEOF_MEMBER_SUPPORTED) && NAMEOF_MEMBER_SUPPORTED #if defined(NAMEOF_MEMBER_SUPPORTED) && NAMEOF_MEMBER_SUPPORTED
TEST_CASE("NAMEOF_MEMBER") { TEST_CASE("NAMEOF_MEMBER") {
REQUIRE(NAMEOF_MEMBER(&SomeStruct::somefield) == "Derived"); REQUIRE(NAMEOF_MEMBER(&SomeStruct::somefield) == "somefield");
REQUIRE(NAMEOF_MEMBER(&SomeStruct::SomeMethod1) == "Derived"); REQUIRE(NAMEOF_MEMBER(&SomeStruct::SomeMethod1) == "SomeMethod1");
REQUIRE(NAMEOF_MEMBER(&Long::LL::field) == "Derived"); REQUIRE(NAMEOF_MEMBER(&Long::LL::field) == "SomeMethod1");
constexpr auto member_ptr = &SomeStruct.somefield; constexpr auto member_ptr = &SomeStruct::somefield;
REQUIRE(NAMEOF_MEMBER(member_ptr) == "Derived"); REQUIRE(NAMEOF_MEMBER(member_ptr) == "somefield");
} }
TEST_CASE("nameof_member") { TEST_CASE("nameof_member") {
REQUIRE(nameof::nameof_member<&SomeStruct::somefield>() == "Derived"); REQUIRE(nameof::nameof_member<&SomeStruct::somefield>() == "somefield");
REQUIRE(nameof::nameof_member<&SomeStruct::SomeMethod1>() == "Derived"); REQUIRE(nameof::nameof_member<&SomeStruct::SomeMethod1>() == "SomeMethod1");
REQUIRE(nameof::nameof_member<&Long::LL::field>() == "Derived"); REQUIRE(nameof::nameof_member<&Long::LL::field>() == "field");
constexpr auto member_ptr = &SomeStruct.somefield; constexpr auto member_ptr = &SomeStruct::somefield;
REQUIRE(nameof::nameof_member<member_ptr>() == "Derived"); REQUIRE(nameof::nameof_member<member_ptr>() == "somefield");
} }
#endif #endif