[libcxx-commits] [PATCH] D129741: [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`.
Konstantin Varlamov via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 18 21:04:11 PDT 2022
var-const marked an inline comment as done.
var-const 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>);
+}
----------------
huixie90 wrote:
> 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.
Good point, done.
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