Loading...
tests/intrusive_shared_ptr_src/ctor.nullptr.cpp /dev/null xnu-12377.121.6
--- /dev/null
+++ xnu/xnu-12377.121.6/tests/intrusive_shared_ptr_src/ctor.nullptr.cpp
@@ -0,0 +1,33 @@
+//
+// Tests for
+//  intrusive_shared_ptr(nullptr_t);
+//
+
+#include <libkern/c++/intrusive_shared_ptr.h>
+#include <darwintest.h>
+#include <darwintest_utils.h>
+#include "test_policy.h"
+
+struct T { int i; };
+
+template <typename T>
+static void
+tests()
+{
+	{
+		libkern::intrusive_shared_ptr<T, test_policy> ptr = nullptr;
+		CHECK(ptr.get() == nullptr);
+	}
+	{
+		libkern::intrusive_shared_ptr<T, test_policy> ptr{nullptr};
+		CHECK(ptr.get() == nullptr);
+	}
+	{
+		libkern::intrusive_shared_ptr<T, test_policy> ptr(nullptr);
+		CHECK(ptr.get() == nullptr);
+	}
+}
+
+T_DECL(ctor_nullptr, "intrusive_shared_ptr.ctor.nullptr", T_META_TAG_VM_PREFERRED) {
+	tests<T>();
+}