boostorg / spirit

Boost.org spirit module
http://boost.org/libs/spirit
394 stars 162 forks source link

Build error C2061: syntax error: identifier 'BOOST_SCOPED_ENUM' on Windows MSVC #779

Closed Od0VxibTqto6Hs closed 9 months ago

Od0VxibTqto6Hs commented 11 months ago

Desc

Boost.Spirit failed build with "error C2061: syntax error: identifier 'BOOST_SCOPED_ENUM' " on Windows MSVC.

Info

Reproduce Steps

Open x64 Native Tools Command Prompt for VS 2022

git clone --recursive --depth=1 https://github.com/boostorg/boost.git
cd boost
bootstrap
b2 headers variant=release --build-dir=out\amd64rel address-model=64
b2 variant=release --build-dir=out\amd64rel address-model=64
:: build Boost.Spirit
:: b2 variant=release --build-dir=out\amd64rel libs\spirit\test address-model=64
:: or the command
cl.exe -Zm800 -nologo "libs\spirit\test\karma\binary1.cpp" -c -TP -wd4675 -EHs -GR -Zc:throwingNew -O2 -Ob2 -W3 -MD -Zc:forScope -Zc:wchar_t -Zc:inline -Gw -favor:blend -wd4244 -wd4365 -wd4459 -D"BOOST_ALL_NO_LIB=1" -D"BOOST_BIND_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_COBALT_USE_STD_PMR=1" -D"BOOST_ENDIAN_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_FUNCTION_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_HASH_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_SMART_PTR_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_SYSTEM_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_TYPEOF_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"BOOST_UNORDERED_DETAIL_REQUIRES_CXX11_HPP_INCLUDED" -D"NDEBUG" -I"." -I"libs\spirit\test\karma"

Error

binary1.cpp
.\boost/spirit/home/karma/binary/binary.hpp(197): error C2061: syntax error: identifier 'BOOST_SCOPED_ENUM'
.\boost/spirit/home/karma/binary/binary.hpp(198): error C2913: explicit specialization; 'boost::spirit::karma::detail::what' is not a specialization of a class template
.\boost/spirit/home/karma/binary/binary.hpp(207): error C2913: explicit specialization; 'boost::spirit::karma::detail::what' is not a specialization of a class template
.\boost/spirit/home/karma/binary/binary.hpp(216): error C2913: explicit specialization; 'boost::spirit::karma::detail::what' is not a specialization of a class template
.\boost/spirit/home/karma/binary/binary.hpp(220): error C2061: syntax error: identifier 'BOOST_SCOPED_ENUM'
.\boost/spirit/home/karma/binary/binary.hpp(222): error C2882: 'endian': illegal use of namespace identifier in expression
.\boost/spirit/home/karma/binary/binary.hpp(222): note: the template instantiation context (the oldest one first) is
.\boost/spirit/home/karma/binary/binary.hpp(280): note: see reference to class template instantiation 'boost::spirit::karma::any_binary_generator<T>' being compiled
.\boost/spirit/home/karma/binary/binary.hpp(222): error C2065: 'bits': undeclared identifier
.\boost/spirit/home/karma/binary/binary.hpp(222): error C2977: 'boost::spirit::karma::any_binary_generator': too many template arguments
.\boost/spirit/home/karma/binary/binary.hpp(222): note: see declaration of 'boost::spirit::karma::any_binary_generator'
.\boost/spirit/home/karma/binary/binary.hpp(222): error C3203: 'any_binary_generator': unspecialized class template can't be used as a template argument for template parameter 'Derived', expected a real type
...
Kojoley commented 9 months ago

Fixed by #783