[all-commits] [llvm/llvm-project] dcdb07: [libc++] Work around a Clang bug in transform_view...

Quuxplusone via All-commits all-commits at lists.llvm.org
Mon Dec 6 08:20:30 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dcdb07abce278a65e1a8df164ce9b942da6ebd23
      https://github.com/llvm/llvm-project/commit/dcdb07abce278a65e1a8df164ce9b942da6ebd23
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2021-12-06 (Mon, 06 Dec 2021)

  Changed paths:
    M libcxx/include/__ranges/transform_view.h
    M libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp

  Log Message:
  -----------
  [libc++] Work around a Clang bug in transform_view, and regression-test.

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.

Differential Revision: https://reviews.llvm.org/D115116




More information about the All-commits mailing list