From afc7bbab2367a1be85e44214295e0611fd3271e6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 13 Sep 2026 19:39:27 +0300 Subject: [PATCH] Only use [[msvc::no_unique_address]] on C++20 or later. Refs #499. --- include/boost/config/compiler/visualc.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index a4519f87d..7047c5c3d 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -273,8 +273,10 @@ #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 +#if _MSC_FULL_VER >= 192829913 && _MSVC_LANG >= 202002L +// Even though [[msvc::no_unique_address]] works with /std:c++14 +// and /std:c++17, it issues a warning, which is a problem +// https://github.com/boostorg/config/issues/499 #define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] #endif