[libcxx-commits] [PATCH] D129741: [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`.

Hui via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 18 01:43:55 PDT 2022


huixie90 added inline comments.


================
Comment at: libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp:45-46
+constexpr void dangling_1st(Func&& func, Input& in, Args&& ...args) {
+  using ResultT = decltype(func(R(in), std::forward<Args>(args)...));
+  static_assert(std::same_as<ResultT, ExpectedT>);
+}
----------------
I still prefer
```
decltype(auto) result = func(R(in), std::forward<Args>(args)...);
static_assert(std::same_as<decltype(result), ExpectedT>);
```
or
```
[[maybe_unused]] std::same_as<ExpectedT> decltype(auto) result = func(R(in), std::forward<Args>(args)...);
```
This way the tests actually run the algorithms instead of  just checking the return type.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129741/new/

https://reviews.llvm.org/D129741



More information about the libcxx-commits mailing list