[PATCH] D146368: [clang-tidy] Add readability-reference-to-constructed-temporary check
Shivam Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 25 19:08:24 PDT 2023
xgupta added inline comments.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/reference-to-constructed-temporary.rst:18
+
+ const std::string& value("hello");
+
----------------
PiotrZSL wrote:
> xgupta wrote:
> > The below comment is not matching, do you want to write -
> > `const std::string& str = std::string("hello");`
> > ?
> actually comment is +- fine, constructor to std::string will be called anyway, and for compiler I think those 2 are equal.
> Will verify.
but you have written below `reference variable ``str`` is assigned a temporary object` and there is no str variable.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146368/new/
https://reviews.llvm.org/D146368
More information about the cfe-commits
mailing list