Closed bansan85 closed 11 months ago
Under Windows with Visual Studio Installer, install "clang compiler for Windows"
With CMake, generate a project with toolset "ClangCL" : -G"Visual Studio 2022" -T ClangCL.
-G"Visual Studio 2022" -T ClangCL
Build.
In this case, _MSC_VER is defined but I need to use the BOOST_PFR_CORE_NAME_PARSING from __clang__.
_MSC_VER
BOOST_PFR_CORE_NAME_PARSING
__clang__
https://stackoverflow.com/questions/67599384/distinguish-between-clang-cl-and-msvc-cl
Solution is to check __clang__ first :
#ifndef BOOST_PFR_CORE_NAME_PARSING # if defined(__clang__) # define BOOST_PFR_CORE_NAME_PARSING (sizeof("auto boost::pfr::detail::name_of_field_impl() [MsvcWorkaround = ") - 1, sizeof("}]") - 1, backward(".")) # elif defined(_MSC_VER) # define BOOST_PFR_CORE_NAME_PARSING (sizeof("auto __cdecl boost::pfr::detail::name_of_field_impl<") - 1, sizeof(">(void) noexcept") - 1, backward("->")) # elif defined(__GNUC__) # define BOOST_PFR_CORE_NAME_PARSING (sizeof("consteval auto boost::pfr::detail::name_of_field_impl() [with MsvcWorkaround = ") - 1, sizeof(")]") - 1, backward("::")) # else // Default parser for other platforms... Just skip nothing! # define BOOST_PFR_CORE_NAME_PARSING (0, 0, "") # endif #endif
Here is the fix: https://github.com/boostorg/pfr/pull/149
Close since fix works. Thanks.
Under Windows with Visual Studio Installer, install "clang compiler for Windows"
With CMake, generate a project with toolset "ClangCL" :
-G"Visual Studio 2022" -T ClangCL
.Build.
In this case,
_MSC_VER
is defined but I need to use theBOOST_PFR_CORE_NAME_PARSING
from__clang__
.https://stackoverflow.com/questions/67599384/distinguish-between-clang-cl-and-msvc-cl
Solution is to check
__clang__
first :