[PATCH] D55366: [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, 0>.end() .

Andrey Maksimov via Phabricator reviews at reviews.llvm.org
Thu Dec 6 05:44:34 PST 2018


amakc11 created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne.

The standard section array.zero <http://eel.is/c++draft/array.zero#2.sentence-1> requires the return value of begin() and end() methods of a zero-sized array to be unique. Eric Fiselier <https://reviews.llvm.org/p/EricWF/> clarifies: "That unique value cannot be null, and must be properly aligned". This patch adds checks for the first part of this clarification: unique value returned by these methods cannot be null.


Repository:
  rCXX libc++

https://reviews.llvm.org/D55366

Files:
  test/std/containers/sequences/array/begin.pass.cpp


Index: test/std/containers/sequences/array/begin.pass.cpp
===================================================================
--- test/std/containers/sequences/array/begin.pass.cpp
+++ test/std/containers/sequences/array/begin.pass.cpp
@@ -40,6 +40,11 @@
       typedef NoDefault T;
       typedef std::array<T, 0> C;
       C c = {};
-      assert(c.begin() == c.end());
+      C::iterator ib, ie;
+      ib = c.begin();
+      ie = c.end();
+      assert(ib == ie);
+      assert(ib != nullptr);
+      assert(ie != nullptr);
     }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55366.176959.patch
Type: text/x-patch
Size: 538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181206/1ab3d729/attachment.bin>


More information about the libcxx-commits mailing list