Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msvc][cpplatest] bond failed to build with msvc option /std:c++latest due to error C2027 and error C2061 #1198

Open
Zhaojun-Liu opened this issue Jan 23, 2024 · 1 comment

Comments

@Zhaojun-Liu
Copy link

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.

@UMU618
Copy link

UMU618 commented Aug 28, 2024

bond\protocol\detail\simple_array.h(93,5): error C4996: 'std::is_pod': warning STL4025: std::is_pod and std::is_pod_v are deprecated in C++20. The std::is_trivially_copyable and/or std::is_standard_layout traits likely suit your use case. You can define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants