diff --git a/llvm/include/llvm/ADT/STLForwardCompat.h b/llvm/include/llvm/ADT/STLForwardCompat.h index ad94cdede9288..b975a403cd042 100644 --- a/llvm/include/llvm/ADT/STLForwardCompat.h +++ b/llvm/include/llvm/ADT/STLForwardCompat.h @@ -142,7 +142,10 @@ struct identity // NOLINT(readability-identifier-naming) /// The std::pointer_traits<>::to_address(p) variations of these overloads has /// not been implemented. template auto to_address(const Ptr &P) { return P.operator->(); } -template constexpr T *to_address(T *P) { return P; } +template constexpr T *to_address(T *P) { + static_assert(!std::is_function_v); + return P; +} //===----------------------------------------------------------------------===// // Features from C++23