[libcxx-commits] [PATCH] D121626: [libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 14 10:54:52 PDT 2022
ldionne created this revision.
ldionne added a reviewer: jloser.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Back in 3a208c68942e <https://reviews.llvm.org/rG3a208c68942e9f4d24bd235a6e497852da898cae>, we implemented the range-based constructor for <span>.
However, in doing so, we removed a previous non-standard constructor that
we provided before shipping <ranges>. Unfortunately, that breaks code that
was relying on a range-based constructor until we ship all of <ranges>.
This patch reintroduces the old non-conforming constructors and tests
that were removed in 3a208c68942e <https://reviews.llvm.org/rG3a208c68942e9f4d24bd235a6e497852da898cae> and uses them whenever <ranges> is
not provided (e.g. in LLVM 14). This is only a temporary workaround
until we enable <ranges> by default in C++20, which should hopefully
happen by LLVM 15.
The goal is to cherry-pick this workaround back to the LLVM 14 release
branch, since I suspect the constructor removal may otherwise cause
breakage out there, like the breakage I saw internally.
We could have avoided this situation by waiting for C++20 to be finalized
before shipping std::span. For example, we could have guarded it with
something like _LIBCPP_HAS_NO_INCOMPLETE_RANGES to prevent users from
accidentally starting to depend on it before it is stable. We did not
have these mechanisms when std::span was first implemented, though.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121626
Files:
libcxx/include/span
libcxx/test/libcxx/containers/views/span.cons/range.pass.cpp
libcxx/test/libcxx/containers/views/span.cons/range.verify.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121626.415161.patch
Type: text/x-patch
Size: 12969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220314/d14ed90e/attachment.bin>
More information about the libcxx-commits
mailing list