diff options
-rw-r--r-- | include/llvm/ADT/polymorphic_ptr.h | 2 | ||||
-rw-r--r-- | unittests/ADT/polymorphic_ptr_test.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/ADT/polymorphic_ptr.h b/include/llvm/ADT/polymorphic_ptr.h index 6114b65..a168747 100644 --- a/include/llvm/ADT/polymorphic_ptr.h +++ b/include/llvm/ADT/polymorphic_ptr.h @@ -38,7 +38,7 @@ template <typename T> class polymorphic_ptr { T *ptr; public: - explicit polymorphic_ptr(T *ptr = 0) : ptr(ptr) {} + polymorphic_ptr(T *ptr = 0) : ptr(ptr) {} polymorphic_ptr(const polymorphic_ptr &arg) : ptr(arg->clone()) {} #if LLVM_HAS_RVALUE_REFERENCES polymorphic_ptr(polymorphic_ptr &&arg) : ptr(arg.take()) {} diff --git a/unittests/ADT/polymorphic_ptr_test.cpp b/unittests/ADT/polymorphic_ptr_test.cpp index d9a2c3f..fbe60df 100644 --- a/unittests/ADT/polymorphic_ptr_test.cpp +++ b/unittests/ADT/polymorphic_ptr_test.cpp @@ -113,6 +113,11 @@ TEST(polymorphic_ptr_test, Polymorphism) { copy = dummy_copy(b); EXPECT_NE(b, copy); EXPECT_EQ("DerivedB", copy->name()); + + // Test creating a copy out of a temporary directly. + copy = dummy_copy<polymorphic_ptr<Base> >(new DerivedA()); + EXPECT_NE(a, copy); + EXPECT_EQ("DerivedA", copy->name()); } } |