15 #include "absl/base/internal/exception_safety_testing.h"
17 #ifdef ABSL_HAVE_EXCEPTIONS
19 #include "gtest/gtest.h"
20 #include "absl/meta/type_traits.h"
24 exceptions_internal::NoThrowTag nothrow_ctor;
26 exceptions_internal::StrongGuaranteeTagType strong_guarantee;
28 exceptions_internal::ExceptionSafetyTestBuilder<> MakeExceptionSafetyTester() {
32 namespace exceptions_internal {
36 ConstructorTracker* ConstructorTracker::current_tracker_instance_ =
nullptr;
39 if (countdown-- == 0) {
40 if (throw_bad_alloc)
throw TestBadAllocException(
msg);
41 throw TestException(
msg);
46 int countdown) noexcept {
57 if (
static_cast<bool>(TypeSpec::kNoThrowCopy &
spec)) {
58 append(
"kNoThrowCopy");
60 if (
static_cast<bool>(TypeSpec::kNoThrowMove &
spec)) {
61 append(
"kNoThrowMove");
63 if (
static_cast<bool>(TypeSpec::kNoThrowNew &
spec)) {
64 append(
"kNoThrowNew");
70 return static_cast<bool>(AllocSpec::kNoThrowAllocate &
spec)
79 #endif // ABSL_HAVE_EXCEPTIONS