about summary refs log tree commit diff
path: root/absl/types
diff options
context:
space:
mode:
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/any_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/types/any_test.cc b/absl/types/any_test.cc
index aef98f308241..23aa3a58cfe1 100644
--- a/absl/types/any_test.cc
+++ b/absl/types/any_test.cc
@@ -587,10 +587,22 @@ TEST(AnyTest, ConversionConstructionCausesOneCopy) {
 // Tests for Exception Behavior //
 //////////////////////////////////
 
+#if defined(ABSL_HAVE_STD_ANY)
+
+// If using a std `any` implementation, we can't check for a specific message.
+#define ABSL_ANY_TEST_EXPECT_BAD_ANY_CAST(...)                      \
+  ABSL_BASE_INTERNAL_EXPECT_FAIL((__VA_ARGS__), absl::bad_any_cast, \
+                                 "")
+
+#else
+
+// If using the absl `any` implementation, we can rely on a specific message.
 #define ABSL_ANY_TEST_EXPECT_BAD_ANY_CAST(...)                      \
   ABSL_BASE_INTERNAL_EXPECT_FAIL((__VA_ARGS__), absl::bad_any_cast, \
                                  "Bad any cast")
 
+#endif  // defined(ABSL_HAVE_STD_ANY)
+
 TEST(AnyTest, ThrowBadAlloc) {
   {
     absl::any a;