diff --git a/api/test/nostd/string_view_test.cc b/api/test/nostd/string_view_test.cc index 52c72ea4d8..b0eca88eb1 100644 --- a/api/test/nostd/string_view_test.cc +++ b/api/test/nostd/string_view_test.cc @@ -72,7 +72,7 @@ TEST(StringViewTest, SubstrOutOfRange) { string_view s = "abc123"; #if __EXCEPTIONS || ((defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020))) - EXPECT_THROW(s.substr(10), std::out_of_range); + EXPECT_THROW((void)s.substr(10), std::out_of_range); #else EXPECT_DEATH({ s.substr(10); }, ""); #endif