summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/polymorphic_ptr_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ADT/polymorphic_ptr_test.cpp b/unittests/ADT/polymorphic_ptr_test.cpp
index fbe60df523..bd5d83879a 100644
--- a/unittests/ADT/polymorphic_ptr_test.cpp
+++ b/unittests/ADT/polymorphic_ptr_test.cpp
@@ -82,6 +82,12 @@ TEST(polymorphic_ptr_test, Basic) {
EXPECT_FALSE(!p3);
EXPECT_NE(s, &*p3);
EXPECT_EQ(42, p3->x);
+
+ // Force copies of null without trying to dereference anything.
+ polymorphic_ptr<S> null_copy = dummy_copy(polymorphic_ptr<S>(null));
+ EXPECT_FALSE((bool)null_copy);
+ EXPECT_TRUE(!null_copy);
+ EXPECT_EQ(null, null_copy);
}
struct Base {