diff --git a/include/llvm/ADT/ArrayRef.h b/include/llvm/ADT/ArrayRef.h index b93142d90bc..8c14a423c8f 100644 --- a/include/llvm/ADT/ArrayRef.h +++ b/include/llvm/ADT/ArrayRef.h @@ -112,16 +112,6 @@ namespace llvm { std::is_convertible::value>::type* = 0) : Data(A.data()), Length(A.size()) {} - /// Construct an ArrayRef from an ArrayRef where T is a super class - /// of U. This uses SFINAE to ensure that only ArrayRefs with this property - /// can be converted. This is an upcasting constructor. - template - ArrayRef(const ArrayRef &A, - typename std::enable_if::type, - typename std::remove_pointer::type>::value>::type * = 0) - : Data(reinterpret_cast(A.data())), Length(A.size()) {} - /// @} /// @name Simple Operations /// @{ diff --git a/unittests/ADT/ArrayRefTest.cpp b/unittests/ADT/ArrayRefTest.cpp index 9cd17f00d9a..f9c98a563fa 100644 --- a/unittests/ADT/ArrayRefTest.cpp +++ b/unittests/ADT/ArrayRefTest.cpp @@ -90,39 +90,4 @@ TEST(ArrayRefTest, ConstConvert) { a = ArrayRef(A); } -struct A { - int data; - - A() : data(0) {} -}; - -struct B : A { - int data2; - - B() : A(), data2(0) {} -}; - -TEST(ArrayRefTest, UpcastConvert) { - B Data[5]; - - for (unsigned i = 0, e = 5; i != e; ++i) { - Data[i].data = i + 5; - Data[i].data2 = i + 30; - } - - B *DataPtrs[5]; - for (unsigned i = 0, e = 5; i != e; ++i) { - DataPtrs[i] = &Data[i]; - } - - ArrayRef BArray(DataPtrs, 5); - ArrayRef AArray(BArray); - - EXPECT_TRUE(AArray.size() == 5); - for (unsigned i = 0, e = 5; i != e; ++i) { - A *a = AArray[i]; - EXPECT_TRUE(a->data == int(i + 5)); - } -} - } // end anonymous namespace