Skip to content

Commit

Permalink
Avoid bugprone-move-forwarding-reference warning in Clang (#4560)
Browse files Browse the repository at this point in the history
Use std::forward<T> instead of std::move, on an argument with
rvalue-reference of template-deduced type.

See https://clang.llvm.org/extra/clang-tidy/checks/bugprone-move-forwarding-reference.html

Bug: crbug.com/1134310
  • Loading branch information
dneto0 authored Oct 6, 2021
1 parent 0c4deeb commit b469957
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/opt/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ inline IteratorRange<IteratorType> make_range(const IteratorType& begin,
template <typename IteratorType>
inline IteratorRange<IteratorType> make_range(IteratorType&& begin,
IteratorType&& end) {
return {std::move(begin), std::move(end)};
return {std::forward<IteratorType>(begin), std::forward<IteratorType>(end)};
}

// Returns a (begin, end) iterator pair for the given container.
Expand Down

0 comments on commit b469957

Please sign in to comment.