This commit is contained in:
neargye 2022-12-07 01:30:25 +04:00
parent 70ca094db8
commit bc183cd334

View file

@ -113,24 +113,11 @@ enum class OutOfRange {
too_high = NAMEOF_ENUM_RANGE_MAX + 1 too_high = NAMEOF_ENUM_RANGE_MAX + 1
}; };
struct TestRtti{ struct TestRtti {
struct Base { virtual ~Base() = default; }; struct Base { virtual ~Base() = default; };
struct Derived : Base {}; struct Derived : Base {};
}; };
#if defined(NAMEOF_MEMBER_SUPPORTED) && NAMEOF_MEMBER_SUPPORTED
struct StructMemberInitializationUsingNameof{
std::string teststringfield = std::string{nameof::nameof_member<&StructMemberInitializationUsingNameof::teststringfield>()};
};
struct StructWithNonConstexprDestructor{
~StructWithNonConstexprDestructor(){}
int somefield;
};
#endif
SomeStruct struct_var; SomeStruct struct_var;
Long othervar; Long othervar;
SomeStruct* ptr_s = &struct_var; SomeStruct* ptr_s = &struct_var;
@ -923,6 +910,15 @@ TEST_CASE("NAMEOF_SHORT_TYPE_RTTI") {
#if defined(NAMEOF_MEMBER_SUPPORTED) && NAMEOF_MEMBER_SUPPORTED #if defined(NAMEOF_MEMBER_SUPPORTED) && NAMEOF_MEMBER_SUPPORTED
struct StructMemberInitializationUsingNameof {
std::string teststringfield = std::string{nameof::nameof_member<&StructMemberInitializationUsingNameof::teststringfield>()};
};
struct StructWithNonConstexprDestructor {
~StructWithNonConstexprDestructor() {}
int somefield;
};
TEST_CASE("NAMEOF_MEMBER") { TEST_CASE("NAMEOF_MEMBER") {
REQUIRE(NAMEOF_MEMBER(&SomeStruct::somefield) == "somefield"); REQUIRE(NAMEOF_MEMBER(&SomeStruct::somefield) == "somefield");
REQUIRE(NAMEOF_MEMBER(&SomeStruct::SomeMethod1) == "SomeMethod1"); REQUIRE(NAMEOF_MEMBER(&SomeStruct::SomeMethod1) == "SomeMethod1");