This repository was archived by the owner on Apr 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 331
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
[msvc][cpplatest] bond failed to build with msvc option /std:c++latest due to error C2027 and error C2061 #1198
Copy link
Copy link
Open
Labels
Description
Hi,
Bond failed to build due to error C2027 and error C2061 with msvc option /std:c++latest. Could you take a look this issue? Thanks~
Repro steps:
- Open a x64 Native Tools Command Prompt for VS 2022.
- git clone https://github.com/microsoft/bond F:\gitP\Microsoft\bond
- git -C "F:\gitP\Microsoft\bond" reset --hard b13fee1
- git -C "F:\gitP\Microsoft\bond" submodule sync
- git -C "F:\gitP\Microsoft\bond" submodule update --init --recursive
- git clone https://github.com/Microsoft/vcpkg F:\gitP\Microsoft\vcpkg
- git -C "F:\gitP\Microsoft\vcpkg" reset --hard 23ceb9c
- cd /d F:\gitP\Microsoft\vcpkg
- bootstrap-vcpkg.bat
- vcpkg.exe install --recurse boost-assign boost-config boost-locale boost-utility boost-multiprecision rapidjson --triplet x64-windows --clean-after-build
- set _CL_= /std:c++latest /wd4267 /D_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS /D_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS /D_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS
- cd /d F:\gitP\Microsoft\bond\tools
- curl https://github.com/microsoft/bond/releases/download/10.0.0/gbc-10.0.0-amd64.zip -O -L 2>&1
- powershell -command "Expand-Archive -Force -Path gbc-10.0.0-amd64.zip -DestinationPath .\ "
- mkdir /d F:\gitP\Microsoft\bond\build_amd64 & cd /d F:\gitP\Microsoft\bond\build_amd64
- set PreferredToolArchitecture=x64
- cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.22621.0 -DBOND_GBC_PATH=F:\gitP\Microsoft\bond\tools\gbc-10.0.0-amd64.exe -DBOND_FIND_RAPIDJSON=TRUE -DBOND_STACK_OPTIONS=--allow-different-user -DCMAKE_TOOLCHAIN_FILE=F:\gitP\Microsoft\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
- msbuild /m /p:Platform=x64 /p:Configuration=Release bond.sln /t:Rebuild
Expected result: pass.
Actual result:
61>F:\gitP\Microsoft\bond\cpp\inc\bond\ext\capped_allocator.h(80,88): error C2061: syntax error: identifier 'reference' [F:\gitP\Microsoft\bond\build_amd64\examples\cpp\core\capped_allocator\capped_allocator.vcxproj]
(compiling source file 'Release/capped_allocator_types.cpp')
61>F:\gitP\Microsoft\bond\cpp\inc\bond\ext\capped_allocator.h(81,94): error C2027: use of undefined type 'bond::ext::detail::allocator_reference_type_workaround<Alloc,void>' [F:\gitP\Microsoft\bond\build_amd64\examples\cpp\core\capped_allocator\capped_allocator.vcxproj]
Detailed log:
bond_Build_errorC2027.log
Note: If delete the 3 macro definitions in step 11, error C4996 will appear, see the log below for details.
bond_Build_errorC4996.log
Workaround:
for error C2027, If I comment out the 2 lines in https://github.com/microsoft/bond/blob/master/cpp/inc/bond/ext/capped_allocator.h#L80-L81, build will pass.