[PATCH] D69520: [libc++] Disallow dynamic -> static span conversions

Jan Wilken Dörrie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 11:15:35 PDT 2019


jdoerrie created this revision.
jdoerrie added reviewers: mclow.lists, ldionne.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, christof.

[libc++] Disallow dynamic -> static span conversions

This change disallows dynamic to static span conversions. This complies
with the standard, which lists the following constaint in
views.span#span.cons-20.1 [1]:

  Extent == dynamic_extent || Extent == OtherExtent

Thus this should fail if Extent != dynamic_extent && Extent !=
OtherExtent, which is the case when trying to construct a static span
from a dynamic span.

[1] https://eel.is/c++draft/views.span#span.cons-20.1


Repository:
  rCXX libc++

https://reviews.llvm.org/D69520

Files:
  libcxx/include/span
  libcxx/test/std/containers/views/span.cons/span.fail.cpp
  libcxx/test/std/containers/views/span.cons/span.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69520.226710.patch
Type: text/x-patch
Size: 6015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191028/295b87e3/attachment-0001.bin>


More information about the cfe-commits mailing list