[PATCH] D119670: [clang] Warn on unqualified calls to std::move and std::forward
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 13 09:33:30 PST 2022
cor3ntin created this revision.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This adds a diagnostic when an unqualified call is resolved
to std::move or std::forward.
This follows some C++ committee discussions where some
people where concerns that this might be an usual anti pattern
particularly britle worth warning about - both because move
is a common name and because these functions accept any values.
This warns inconditionnally of whether the current context is in
std:: or not, as implementations probably want to always qualify
these calls too, to avoid triggering adl accidentally.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119670
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaExpr.cpp
clang/test/SemaCXX/unqualified-std-call-fixits.cpp
clang/test/SemaCXX/unqualified-std-call.cpp
clang/test/SemaCXX/warn-self-move.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119670.408276.patch
Type: text/x-patch
Size: 6338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220213/7e15d7c0/attachment-0001.bin>
More information about the cfe-commits
mailing list