[all-commits] [llvm/llvm-project] cb8a0b: [libc++] [ranges] Introduce _LIBCPP_AUTO_CAST(x) f...

Quuxplusone via All-commits all-commits at lists.llvm.org
Wed Dec 22 09:34:49 PST 2021


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

  Changed paths:
    M libcxx/docs/Status/Cxx2bPapers.csv
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__ranges/access.h
    M libcxx/include/__ranges/all.h
    M libcxx/include/__ranges/size.h
    A libcxx/include/__utility/auto_cast.h
    R libcxx/include/__utility/decay_copy.h
    M libcxx/include/future
    M libcxx/include/module.modulemap
    M libcxx/include/thread
    M libcxx/include/utility
    A libcxx/test/libcxx/diagnostics/detail.headers/utility/auto_cast.module.verify.cpp
    R libcxx/test/libcxx/diagnostics/detail.headers/utility/decay_copy.module.verify.cpp
    M libcxx/test/std/ranges/range.access/range.access.begin/begin.pass.cpp
    M libcxx/test/std/ranges/range.access/range.access.end/end.pass.cpp
    M libcxx/test/std/ranges/range.access/range.prim/size.pass.cpp
    M libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp

  Log Message:
  -----------
  [libc++] [ranges] Introduce _LIBCPP_AUTO_CAST(x) for auto(x).

Clang is gaining `auto(x)` support in D113393; sadly there
seems to be no feature-test macro for it. Zhihao is opening
a core issue for that macro.

Use `_LIBCPP_AUTO_CAST` where C++20 specifies we should use `auto(x)`;
stop using `__decay_copy(x)` in those places.
In fact, remove `__decay_copy` entirely. As of C++20, it's purely
a paper specification tool signifying "Return just `x`, but it was
perfect-forwarded, so we understand you're going to have to call
its move-constructor sometimes." I believe there's no reason we'd
ever need to do its operation explicitly in code.

This heisenbugs away a test failure on MinGW; see D112214.

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




More information about the All-commits mailing list