diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h --- a/llvm/include/llvm/ADT/BitVector.h +++ b/llvm/include/llvm/ADT/BitVector.h @@ -542,7 +542,7 @@ } template - static BitVector &apply(F &&f, BitVector &Out, BitVector const &Arg, + static BitVector &apply(const F &f, BitVector &Out, BitVector const &Arg, ArgTys const &...Args) { assert(llvm::all_of( std::initializer_list{Args.size()...}, diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -835,7 +835,7 @@ template static Error apply(HandlerT &&H, std::unique_ptr E) { assert(appliesTo(*E) && "Applying incorrect handler"); - return H(static_cast(*E)); + return std::forward(H)(static_cast(*E)); } }; @@ -849,7 +849,7 @@ template static Error apply(HandlerT &&H, std::unique_ptr E) { assert(appliesTo(*E) && "Applying incorrect handler"); - H(static_cast(*E)); + std::forward(H)(static_cast(*E)); return Error::success(); } }; @@ -866,7 +866,7 @@ static Error apply(HandlerT &&H, std::unique_ptr E) { assert(appliesTo(*E) && "Applying incorrect handler"); std::unique_ptr SubE(static_cast(E.release())); - return H(std::move(SubE)); + return std::forward(H)(std::move(SubE)); } }; @@ -882,7 +882,7 @@ static Error apply(HandlerT &&H, std::unique_ptr E) { assert(appliesTo(*E) && "Applying incorrect handler"); std::unique_ptr SubE(static_cast(E.release())); - H(std::move(SubE)); + std::forward(H)(std::move(SubE)); return Error::success(); } }; diff --git a/llvm/include/llvm/Support/HashBuilder.h b/llvm/include/llvm/Support/HashBuilder.h --- a/llvm/include/llvm/Support/HashBuilder.h +++ b/llvm/include/llvm/Support/HashBuilder.h @@ -100,7 +100,7 @@ : HashBuilderBase(Hasher) {} template explicit HashBuilderImpl(ArgTypes &&...Args) - : HashBuilderBase(Args...) {} + : HashBuilderBase(std::forward(Args)...) {} /// Implement hashing for hashable data types, e.g. integral or enum values. template