[all-commits] [llvm/llvm-project] 70b1f6: [clang] Warn on unqualified calls to std::move and...

Erich Keane via All-commits all-commits at lists.llvm.org
Thu Feb 24 07:23:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70b1f6de539867353940d3dcb8b25786d5082d63
      https://github.com/llvm/llvm-project/commit/70b1f6de539867353940d3dcb8b25786d5082d63
  Author: Corentin Jabot <corentin.jabot at gmail.com>
  Date:   2022-02-24 (Thu, 24 Feb 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaExpr.cpp
    A clang/test/SemaCXX/unqualified-std-call-fixits.cpp
    A clang/test/SemaCXX/unqualified-std-call.cpp
    M clang/test/SemaCXX/warn-self-move.cpp

  Log Message:
  -----------
  [clang] Warn on unqualified calls to std::move and std::forward

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.

Differential Revision: https://reviews.llvm.org/D119670




More information about the All-commits mailing list