[libcxx-commits] [PATCH] D115116: [libc++] Work around a Clang bug in transform_view, and regression-test.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 5 07:28:37 PST 2021
Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, cjdb, libc++, zoecarver, Mordante.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.
Clang trunk rejects the new test case, but this is a Clang bug (PR47414, 47509, 50864, 44833).
In module 'std' imported from /Users/aodwyer/llvm-project/libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp:17:
/Users/aodwyer/llvm-project/build2/include/c++/v1/__ranges/transform_view.h:85:44: error: constraints not satisfied for alias template 'range_reference_t' [with _Rp = const NonConstView]
regular_invocable<const _Fn&, range_reference_t<const _View>>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/aodwyer/llvm-project/build2/include/c++/v1/__ranges/transform_view.h:416:25: note: in instantiation of template class 'std::ranges::transform_view<NonConstView, (lambda at /Users/aodwyer/llvm-project/libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp:73:71)>' requested here
-> decltype( transform_view(_VSTD::forward<_Range>(__range), _VSTD::forward<_Fn>(__f)))
^
We can work around this by adding a layer of indirection: put the problematic constraint into a named concept and Clang becomes more amenable to SFINAE'ing instead of hard-erroring.
Drive-by simplify `range.transform/general.pass.cpp` to make it clearer what it's actually testing in this area.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115116
Files:
libcxx/include/__ranges/transform_view.h
libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115116.391912.patch
Type: text/x-patch
Size: 4292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211205/d0aeb3cb/attachment.bin>
More information about the libcxx-commits
mailing list