From addaf02387d223e3632c1d131a3b6f8f1e1b21e5 Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:57:04 -0600 Subject: [PATCH] Fix a test issue on MSVC due to TCO --- test/unit/from_current.cpp | 2 +- test/unit/from_current_z.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/from_current.cpp b/test/unit/from_current.cpp index 5ca6d46..c5ee358 100644 --- a/test/unit/from_current.cpp +++ b/test/unit/from_current.cpp @@ -123,7 +123,7 @@ TEST(FromCurrent, RawTrace) { std::vector line_numbers; CPPTRACE_TRY { line_numbers.insert(line_numbers.begin(), __LINE__ + 1); - stacktrace_from_current_1(line_numbers); + static volatile int tco_guard = stacktrace_from_current_1(line_numbers); } CPPTRACE_CATCH(const std::exception& e) { EXPECT_EQ(e.what(), "foobar"sv); const auto& raw_trace = cpptrace::raw_trace_from_current_exception(); diff --git a/test/unit/from_current_z.cpp b/test/unit/from_current_z.cpp index cd6de46..68e25f0 100644 --- a/test/unit/from_current_z.cpp +++ b/test/unit/from_current_z.cpp @@ -42,7 +42,7 @@ TEST(FromCurrentZ, Basic) { std::vector line_numbers; CPPTRACE_TRYZ { line_numbers.insert(line_numbers.begin(), __LINE__ + 1); - stacktrace_from_current_z_1(line_numbers); + static volatile int tco_guard = stacktrace_from_current_z_1(line_numbers); } CPPTRACE_CATCHZ(const std::runtime_error& e) { EXPECT_EQ(e.what(), "foobar"sv); const auto& trace = cpptrace::from_current_exception();