// RUN: %check_clang_tidy -std=c++14 %s cppcoreguidelines-missing-std-forward %t -- \ // RUN: -config="{CheckOptions: {cppcoreguidelines-missing-std-forward.ForwardFunction: custom_forward}}" -- -fno-delayed-template-parsing // NOLINTBEGIN namespace std { template struct remove_reference { using type = T; }; template struct remove_reference { using type = T; }; template struct remove_reference { using type = T; }; template using remove_reference_t = typename remove_reference::type; template constexpr T &&forward(remove_reference_t &t) noexcept; template constexpr T &&forward(remove_reference_t &&t) noexcept; template constexpr remove_reference_t &&move(T &&x); } // namespace std // NOLINTEND template constexpr decltype(auto) custom_forward(std::remove_reference_t& tmp) noexcept { return static_cast(tmp); } template constexpr decltype(auto) custom_forward(std::remove_reference_t&& tmp) noexcept { return static_cast(tmp); } template void forward_with_std(T&& t) { // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: forwarding reference parameter 't' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward] T other{std::forward(t)}; } template void move_with_custom(T&& t) { T other{custom_forward(t)}; }