[PATCH] D123909: [Clang] Use of decltype(capture) in parameter-declaration-clause

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 10:57:03 PDT 2022


aaron.ballman added a subscriber: MaskRay.
aaron.ballman added a comment.

In D123909#3461716 <https://reviews.llvm.org/D123909#3461716>, @hokein wrote:

> Hi, this patch seems to break the following code which was previously compiled:
>
>   #include <type_traits>
>   #include <algorithm>
>   #include <numeric>
>   
>   template <typename It, typename MapFn>
>   auto MapJoin(It first, It last, MapFn map_fn) {
>     return std::accumulate(
>         first, last, map_fn(*first),
>         [=](typename std::result_of<MapFn(decltype(*first))>::type result) {  }); // a new diagnostic: error: captured variable 'first' cannot appear here
>   }

This looks like a true positive to me, at least for the moment (Core is still trying to decide what to do about CWG2569 which may relax some restrictions in this area).

@MaskRay -- your revert was incorrect, please un-revert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123909



More information about the cfe-commits mailing list