Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
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

@Zhaojun-Liu

Description

@Zhaojun-Liu

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:

  1. Open a x64 Native Tools Command Prompt for VS 2022.
  2. git clone https://github.com/microsoft/bond F:\gitP\Microsoft\bond
  3. git -C "F:\gitP\Microsoft\bond" reset --hard b13fee1
  4. git -C "F:\gitP\Microsoft\bond" submodule sync
  5. git -C "F:\gitP\Microsoft\bond" submodule update --init --recursive
  6. git clone https://github.com/Microsoft/vcpkg F:\gitP\Microsoft\vcpkg
  7. git -C "F:\gitP\Microsoft\vcpkg" reset --hard 23ceb9c
  8. cd /d F:\gitP\Microsoft\vcpkg
  9. bootstrap-vcpkg.bat
  10. vcpkg.exe install --recurse boost-assign boost-config boost-locale boost-utility boost-multiprecision rapidjson --triplet x64-windows --clean-after-build
  11. 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
  12. cd /d F:\gitP\Microsoft\bond\tools
  13. curl https://github.com/microsoft/bond/releases/download/10.0.0/gbc-10.0.0-amd64.zip -O -L 2>&1
  14. powershell -command "Expand-Archive -Force -Path gbc-10.0.0-amd64.zip -DestinationPath .\ "
  15. mkdir /d F:\gitP\Microsoft\bond\build_amd64 & cd /d F:\gitP\Microsoft\bond\build_amd64
  16. set PreferredToolArchitecture=x64
  17. 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 ..
  18. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions