Adding a missing constexpr test for reverse_iterator operator[].
authorMarshall Clow <mclow.lists@gmail.com>
Thu, 20 Oct 2016 14:57:34 +0000 (14:57 +0000)
committerMarshall Clow <mclow.lists@gmail.com>
Thu, 20 Oct 2016 14:57:34 +0000 (14:57 +0000)
llvm-svn: 284731

libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp

index 16f4a07..4596d6f 100644 (file)
@@ -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
 }