From 03dc78f0bae87f929b18258d6aa2a4653c00fb56 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 27 Sep 2026 20:11:01 +0300 Subject: [PATCH] Use [[msvc::no_unique_address]] under clang-cl, matching msvc --- include/boost/config/compiler/clang.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp index c76a6d2bf..3cf397175 100644 --- a/include/boost/config/compiler/clang.hpp +++ b/include/boost/config/compiler/clang.hpp @@ -365,6 +365,14 @@ # define BOOST_MAY_ALIAS __attribute__((__may_alias__)) #endif +#if defined(_MSC_VER) && _MSC_VER >= 1930 +// In MSVC mode, [[no_unique_address]] is a no-op, matching MSVC, +// but [[msvc::no_unique_address]] works +// The condition here must match the one in visualc.hpp, to preserve +// the ABI compatibility between MSVC and Clang +#define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +#endif + #ifndef BOOST_COMPILER # define BOOST_COMPILER "Clang version " __clang_version__ #endif