Fix throw_delegate_test when using libc++ with shared libraries

PiperOrigin-RevId: 487707178
Change-Id: Ie8f57a6327a6460ab37566b8b6f56d470f6dd2dc
pull/1272/merge
Derek Mauro 2 years ago committed by Copybara-Service
parent 44bb804570
commit 3a35cb3dff
  1. 16
      absl/base/throw_delegate_test.cc

@ -151,7 +151,21 @@ TEST(ThrowDelegate, ThrowStdUnderflowErrorString) {
}
TEST(ThrowDelegate, ThrowStdBadFunctionCallNoWhat) {
ExpectThrowNoWhat<std::bad_function_call>(ThrowStdBadFunctionCall);
#ifdef ABSL_HAVE_EXCEPTIONS
try {
ThrowStdBadFunctionCall();
FAIL() << "Didn't throw";
} catch (const std::bad_function_call&) {
}
#ifdef _LIBCPP_VERSION
catch (const std::exception&) {
// https://reviews.llvm.org/D92397 causes issues with the vtable for
// std::bad_function_call when using libc++ as a shared library.
}
#endif
#else
EXPECT_DEATH_IF_SUPPORTED(ThrowStdBadFunctionCall(), "");
#endif
}
TEST(ThrowDelegate, ThrowStdBadAllocNoWhat) {

Loading…
Cancel
Save