From a5c2dccff636fa3e082c1b675d9233dc6af13122 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 14 Sep 2026 13:21:21 +0300 Subject: [PATCH] Disable C4848 around [[msvc::no_unique_address]]; only use it on msvc-14.3 and later. Refs #499. --- include/boost/config/compiler/visualc.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index a4519f87d..4fbe96cc4 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -273,9 +273,13 @@ #define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS #endif -#if _MSC_FULL_VER >= 192829913 -// Works with /std:c++14 and /std:c++17, and performs optimization -#define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +#if _MSC_VER >= 1930 +// [[no_unique_address]] is a no-op under MSVC +// [[msvc::no_unique_address]] applies the optimization, and works with /std:c++14 and /std:c++17 +// Even though it's supported from 19.28 onwards, we only enable it from 19.30, so that a minor +// compiler update doesn't change ABI +#define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS \ + __pragma(warning(push)) __pragma(warning(disable: 4848)) [[msvc::no_unique_address]] __pragma(warning(pop)) #endif //