diff --git a/test/test_cpp20/custom_error.cpp b/test/test_cpp20/custom_error.cpp index 2714fa83..34a0ea38 100644 --- a/test/test_cpp20/custom_error.cpp +++ b/test/test_cpp20/custom_error.cpp @@ -61,13 +61,10 @@ TEST_CASE("custom_error_logger") REQUIRE(fileNameSv.find("custom_error.cpp") != std::string::npos); const auto functionNameSv = std::string_view(s_loggerArgs.functionName); REQUIRE(!functionNameSv.empty()); -#if defined(__GNUC__) && !defined(__clang__) - REQUIRE(functionNameSv == "void {anonymous}::FailOnLine15()"); -#elif defined(__GNUC__) && defined(__clang__) - REQUIRE(functionNameSv == "void (anonymous namespace)::FailOnLine15()"); -#else - REQUIRE(functionNameSv == "FailOnLine15"); -#endif + // Every compiler has a slightly different naming approach for this function, and even the same + // compiler can change its mind over time. Instead of matching the entire function name just + // match against the part we care about. + REQUIRE((functionNameSv.find("FailOnLine15") != std::string_view::npos)); REQUIRE(s_loggerArgs.returnAddress); REQUIRE(s_loggerArgs.result == static_cast(0x80000018)); // E_ILLEGAL_DELEGATE_ASSIGNMENT)