From 18791a81b92e721c50a8c5bfb0780f53b7030cce Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen <4643818-rmlarsen1@users.noreply.gitlab.com> Date: Sat, 21 Feb 2026 00:13:58 -0800 Subject: [PATCH] Fix MSVC build: disable [[msvc::forceinline]] on generic lambdas libeigen/eigen!2171 Co-authored-by: Rasmus Munk Larsen --- Eigen/src/Core/util/Macros.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index b73f2ac8f..a2701035d 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -908,12 +908,11 @@ // EIGEN_LAMBDA_ALWAYS_INLINE forces inlining of lambda functions. // On GCC/Clang, __attribute__((always_inline)) works on lambdas. -// On MSVC, __forceinline cannot be applied to lambdas, but the -// [[msvc::forceinline]] attribute (available since VS 2022 17.1) can. +// On MSVC, [[msvc::forceinline]] cannot be applied to generic lambdas +// (those with auto parameters), so we leave it empty and rely on the +// optimizer to inline small lambda bodies at /O2. #if EIGEN_COMP_GNUC && !defined(SYCL_DEVICE_ONLY) #define EIGEN_LAMBDA_ALWAYS_INLINE __attribute__((always_inline)) -#elif EIGEN_COMP_MSVC >= 1931 -#define EIGEN_LAMBDA_ALWAYS_INLINE [[msvc::forceinline]] #else #define EIGEN_LAMBDA_ALWAYS_INLINE #endif