[PATCH] D45163: [Sema] -Wunused-value: diagnose unused std::move() call results.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 14:53:31 PDT 2018


Quuxplusone added a comment.

> I think it wouldn't be unreasonable to ask standard library maintainers to add `[[nodiscard]]` to `std::move`

+1. Also `std::forward`, for sure. Basically any metaprogramming function that is statically known to return a reference to its argument.
This knowledge is already in the brains of library vendors; they ought to just write it down in the form of `[[nodiscard]]` annotations. This PR smells like Clang is trying to "cut out the middleman" and just make up its own proprietary list of metaprogramming functions that are statically known to return references to arguments, which is not the most effective or futureproof way to go about it. Let the library vendors deal with it, please, says me.


Repository:
  rC Clang

https://reviews.llvm.org/D45163





More information about the cfe-commits mailing list