diff --git a/thrust/thrust/optional.h b/thrust/thrust/optional.h index 1c31e9c8cc9..8b1894bd659 100644 --- a/thrust/thrust/optional.h +++ b/thrust/thrust/optional.h @@ -1998,7 +1998,6 @@ _CCCL_HOST_DEVICE constexpr auto optional_map_impl(Opt&& opt, F&& f) return opt.has_value() ? detail::invoke(std::forward(f), *std::forward(opt)) : optional(nullopt); } -_CCCL_SUPPRESS_DEPRECATED_PUSH _CCCL_EXEC_CHECK_DISABLE template (f), *std::forward(opt)); +# if _CCCL_COMPILER(MSVC) + // MSVC fails to suppress the warning on make_optional + _CCCL_SUPPRESS_DEPRECATED_PUSH + return optional(monostate{}); + _CCCL_SUPPRESS_DEPRECATED_POP +# else + _CCCL_SUPPRESS_DEPRECATED_PUSH return make_optional(monostate{}); + _CCCL_SUPPRESS_DEPRECATED_POP +# endif } return optional(nullopt); } -_CCCL_SUPPRESS_DEPRECATED_POP # else _CCCL_EXEC_CHECK_DISABLE template