[libcxx] r284731 - Adding a missing constexpr test for reverse_iterator operator[].
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 20 07:57:35 PDT 2016
Author: marshall
Date: Thu Oct 20 09:57:34 2016
New Revision: 284731
URL: http://llvm.org/viewvc/llvm-project?rev=284731&view=rev
Log:
Adding a missing constexpr test for reverse_iterator operator[].
Modified:
libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp
Modified: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp?rev=284731&r1=284730&r2=284731&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp Thu Oct 20 09:57:34 2016
@@ -17,6 +17,7 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -35,4 +36,14 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 4, '1');
test(s+5, 4, '1');
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p + 5);
+ static_assert(it1[0] == '5', "");
+ static_assert(it1[4] == '1', "");
+ }
+#endif
}
More information about the cfe-commits
mailing list