eth-cscs / DLA-Future

DLA-Future
https://eth-cscs.github.io/DLA-Future/master/
BSD 3-Clause "New" or "Revised" License
64 stars 14 forks source link

Correctly move callable `f` in `Unwrapping` call operator #959

Closed msimberg closed 1 year ago

msimberg commented 1 year ago

The previous implementation was potentially buggy for cases when the Unwrapping call operator is called more than once, since f was for the actual call.

As far as I could tell we're not actually affected by this bug since we only ever call the Unwrapping call operator once.

This splits the call operator into two && and & qualified overloads, with the latter not moving f. Note that the latter is not const& because that would fail with wrapped call operators that are not const-qualified. The Duplicate call operator was one such call operator. I've changed the latter to be const-qualified but I've also left the Unwrapping call operator as & in case we introduce other call operators that actually need to be non-const.

@aurianer you can apply the same change in #930 to ConsumeRvalues.

msimberg commented 1 year ago

cscs-ci run

msimberg commented 1 year ago

cscs-ci run