diff --git a/test/core/gprpp/no_destruct_test.cc b/test/core/gprpp/no_destruct_test.cc index c890277d388..954e5a84c32 100644 --- a/test/core/gprpp/no_destruct_test.cc +++ b/test/core/gprpp/no_destruct_test.cc @@ -14,6 +14,8 @@ #include "src/core/lib/gprpp/no_destruct.h" +#include + #include #include @@ -22,10 +24,23 @@ namespace grpc_core { namespace testing { namespace { +class CrashOnDestruction { + public: + void Exists() {} + + private: + ~CrashOnDestruction() { abort(); } +}; + NoDestruct> g_test_int(new int(42)); +NoDestruct g_test_crash_on_destruction; TEST(NoDestruct, Works) { EXPECT_EQ(42, **g_test_int); } +TEST(NoDestruct, CrashOnDestructionIsAccessible) { + g_test_crash_on_destruction->Exists(); +} + } // namespace } // namespace testing } // namespace grpc_core