diff options
Diffstat (limited to 'src/third_party/abseil-cpp-master/abseil-cpp/absl/types/any_exception_safety_test.cc')
-rw-r--r-- | src/third_party/abseil-cpp-master/abseil-cpp/absl/types/any_exception_safety_test.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/third_party/abseil-cpp-master/abseil-cpp/absl/types/any_exception_safety_test.cc b/src/third_party/abseil-cpp-master/abseil-cpp/absl/types/any_exception_safety_test.cc index f9dd8c482c2..31c1140135f 100644 --- a/src/third_party/abseil-cpp-master/abseil-cpp/absl/types/any_exception_safety_test.cc +++ b/src/third_party/abseil-cpp-master/abseil-cpp/absl/types/any_exception_safety_test.cc @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -14,6 +14,12 @@ #include "absl/types/any.h" +#include "absl/base/config.h" + +// This test is a no-op when absl::any is an alias for std::any and when +// exceptions are not enabled. +#if !defined(ABSL_USES_STD_ANY) && defined(ABSL_HAVE_EXCEPTIONS) + #include <typeinfo> #include <vector> @@ -135,8 +141,7 @@ TEST(AnyExceptionSafety, Assignment) { EXPECT_TRUE(strong_empty_any_tester.Test(assign_val)); EXPECT_TRUE(strong_empty_any_tester.Test(move)); } -// libstdc++ std::any fails this test -#if !defined(ABSL_HAVE_STD_ANY) + TEST(AnyExceptionSafety, Emplace) { auto initial_val = absl::any{absl::in_place_type_t<Thrower>(), 1, testing::nothrow_ctor}; @@ -162,6 +167,7 @@ TEST(AnyExceptionSafety, Emplace) { EXPECT_TRUE(empty_tester.Test(emp_thrower)); EXPECT_TRUE(empty_tester.Test(emp_throwervec)); } -#endif // ABSL_HAVE_STD_ANY } // namespace + +#endif // #if !defined(ABSL_USES_STD_ANY) && defined(ABSL_HAVE_EXCEPTIONS) |