[libcxx-commits] [PATCH] D118049: [libcxx][test] the domain of == for forward iterators is iterator values from the same range

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 24 09:46:02 PST 2022


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

LGTM % discussion on whether we should eliminate the bogus test in `libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp` entirely.



================
Comment at: libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp:57
         typename C::iterator i2;
-        assert ( i1 != i2 );
+        LIBCPP_ASSERT( i1 != i2 );
         i2 = i1;
----------------
> Default-initialized basic_string iterators are not portably in the domain of ==.

Oh yeah, because they can conformingly be just garbage-initialized `const char*`s, right? Makes sense. We probably shouldn't even be testing this case, then.


================
Comment at: libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/ranges_uninitialized_copy.pass.cpp:221
     int out[N] = {6, 7, 8, 9, 10};
-    assert(!std::equal(in, in + N, in, out + N));
+    assert(!std::equal(in, in + N, out, out + N));
 
----------------
Mild yikes. Did MSVC catch this with a warning, instrumented debug iterators, or otherwise?


================
Comment at: libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/ranges_uninitialized_copy.pass.cpp:328
+    int in[N] = {1, 2, 3};
+    Buffer<double, N> out;
 
----------------
This is "silence some truncation warnings," right? SGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118049/new/

https://reviews.llvm.org/D118049



More information about the libcxx-commits mailing list