Skip to content

Commit

Permalink
Fix variant test code for C++ 17
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan committed Dec 14, 2023
1 parent 5e7eee7 commit d029d19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/test/nostd/string_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TEST(StringViewTest, SubstrPortion)
TEST(StringViewTest, SubstrOutOfRange)
{
string_view s = "abc123";
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020))
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2017))
EXPECT_THROW((void)s.substr(10), std::out_of_range);
#else
EXPECT_DEATH({ s.substr(10); }, "");
Expand Down
2 changes: 1 addition & 1 deletion api/test/nostd/variant_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST(VariantTest, Get)
EXPECT_EQ(nostd::get<int>(w), 12);
EXPECT_EQ(*nostd::get_if<int>(&v), 12);
EXPECT_EQ(nostd::get_if<float>(&v), nullptr);
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020))
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2017))
EXPECT_THROW(nostd::get<float>(w), nostd::bad_variant_access);
#else
EXPECT_DEATH({ nostd::get<float>(w); }, "");
Expand Down

0 comments on commit d029d19

Please sign in to comment.