fix build
This commit is contained in:
parent
5e62b1f849
commit
bb8cf28a6d
3 changed files with 10 additions and 13 deletions
|
@ -48,13 +48,13 @@ struct Long {
|
|||
LL ll;
|
||||
};
|
||||
|
||||
int somevar = 0;
|
||||
int somevar;
|
||||
|
||||
enum class Color { RED, GREEN, BLUE };
|
||||
|
||||
void TestCase1() {
|
||||
SomeStruct somevar{};
|
||||
Long othervar{};
|
||||
SomeStruct somevar;
|
||||
Long othervar;
|
||||
int intvar;
|
||||
SomeStruct* ptrvar;
|
||||
SomeStruct** ptrptrvar;
|
||||
|
@ -84,7 +84,6 @@ void TestCase1() {
|
|||
std::cout << NAMEOF(~intvar) << std::endl; // intvar
|
||||
std::cout << NAMEOF(!intvar) << std::endl; // intvar
|
||||
|
||||
std::cout << NAMEOF(somevar.SomeMethod1) << std::endl; // SomeMethod1
|
||||
std::cout << NAMEOF(&SomeStruct::SomeMethod2) << std::endl; // SomeMethod2
|
||||
std::cout << NAMEOF(SomeMethod3) << std::endl; // SomeMethod3
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ inline constexpr const char* Nameof(const char* name, const std::size_t length,
|
|||
#define NAMEOF(name) ::nameof::Nameof(NAMEOF_RAW(name), sizeof(NAMEOF_RAW(name)) / sizeof(char) - 1, sizeof(void(*)(__typeof__(name))))
|
||||
|
||||
// Used to obtain the string full name of a variable, type, function and etc.
|
||||
#define NAMEOF_FULL(name) ::nameof::Nameof(NAMEOF_RAW(name), sizeof(void(*)(__typeof__(name))))
|
||||
#define NAMEOF_FULL(name) ::nameof::Nameof(NAMEOF_RAW(name), 0, sizeof(void(*)(__typeof__(name))))
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -53,12 +53,12 @@ struct Long {
|
|||
LL ll;
|
||||
};
|
||||
|
||||
int somevar = 0;
|
||||
int somevar;
|
||||
|
||||
enum class Color { RED, GREEN, BLUE };
|
||||
|
||||
TEST_CASE("constexpr") {
|
||||
SomeStruct somevar{};
|
||||
SomeStruct somevar;
|
||||
|
||||
SECTION("NAMEOF") {
|
||||
constexpr auto n = NAMEOF(somevar);
|
||||
|
@ -82,8 +82,8 @@ TEST_CASE("constexpr") {
|
|||
}
|
||||
|
||||
TEST_CASE("NAMEOF") {
|
||||
SomeStruct somevar{};
|
||||
Long othervar{};
|
||||
SomeStruct somevar;
|
||||
Long othervar;
|
||||
int intvar;
|
||||
SomeStruct* ptrvar;
|
||||
SomeStruct** ptrptrvar;
|
||||
|
@ -122,7 +122,6 @@ TEST_CASE("NAMEOF") {
|
|||
}
|
||||
|
||||
SECTION("NAMEOF_FUNCTION") {
|
||||
REQUIRE(std::strcmp(NAMEOF(somevar.SomeMethod1), "SomeMethod1") == 0);
|
||||
REQUIRE(std::strcmp(NAMEOF(&SomeStruct::SomeMethod2), "SomeMethod2") == 0);
|
||||
REQUIRE(std::strcmp(NAMEOF(SomeMethod3), "SomeMethod3") == 0);
|
||||
}
|
||||
|
@ -134,8 +133,8 @@ TEST_CASE("NAMEOF") {
|
|||
}
|
||||
|
||||
TEST_CASE("NAMEOF_FULL") {
|
||||
SomeStruct somevar{};
|
||||
Long othervar{};
|
||||
SomeStruct somevar;
|
||||
Long othervar;
|
||||
int intvar;
|
||||
SomeStruct* ptrvar;
|
||||
SomeStruct** ptrptrvar;
|
||||
|
@ -175,7 +174,6 @@ TEST_CASE("NAMEOF_FULL") {
|
|||
}
|
||||
|
||||
SECTION("NAMEOF_FUNCTION_FULL") {
|
||||
REQUIRE(std::strcmp(NAMEOF_FULL(somevar.SomeMethod1), "somevar.SomeMethod1") == 0);
|
||||
REQUIRE(std::strcmp(NAMEOF_FULL(&SomeStruct::SomeMethod2), "&SomeStruct::SomeMethod2") == 0);
|
||||
REQUIRE(std::strcmp(NAMEOF_FULL(SomeMethod3), "SomeMethod3") == 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue