[llvm] r216821 - Add a test for converting ArrayRef<T *> to ArrayRef<const T *>.
Craig Topper
craig.topper at gmail.com
Sat Aug 30 09:48:19 PDT 2014
Author: ctopper
Date: Sat Aug 30 11:48:19 2014
New Revision: 216821
URL: http://llvm.org/viewvc/llvm-project?rev=216821&view=rev
Log:
Add a test for converting ArrayRef<T *> to ArrayRef<const T *>.
Modified:
llvm/trunk/unittests/ADT/ArrayRefTest.cpp
Modified: llvm/trunk/unittests/ADT/ArrayRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ArrayRefTest.cpp?rev=216821&r1=216820&r2=216821&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ArrayRefTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ArrayRefTest.cpp Sat Aug 30 11:48:19 2014
@@ -63,4 +63,14 @@ TEST(ArrayRefTest, EmptyEquals) {
EXPECT_TRUE(ArrayRef<unsigned>() == ArrayRef<unsigned>());
}
+TEST(ArrayRefTest, ConstConvert) {
+ int buf[4];
+ for (int i = 0; i < 4; ++i)
+ buf[i] = i;
+
+ static int *A[] = {&buf[0], &buf[1], &buf[2], &buf[3]};
+ ArrayRef<const int *> a((ArrayRef<int *>(A)));
+ a = ArrayRef<int *>(A);
+}
+
} // end anonymous namespace
More information about the llvm-commits
mailing list