summaryrefslogtreecommitdiff
path: root/absl/base
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-11-10 19:52:53 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-11-10 19:53:26 -0800
commit3a35cb3dffea155c6778cf43bc023fca583730e0 (patch)
tree404ce578f1883a6b233254967d997dbba3af98f4 /absl/base
parent44bb804570f1efc9d72f503149e512719a8e4441 (diff)
Fix throw_delegate_test when using libc++ with shared libraries
PiperOrigin-RevId: 487707178 Change-Id: Ie8f57a6327a6460ab37566b8b6f56d470f6dd2dc
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/throw_delegate_test.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/absl/base/throw_delegate_test.cc b/absl/base/throw_delegate_test.cc
index 40f7f102..e74362b7 100644
--- a/absl/base/throw_delegate_test.cc
+++ b/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) {