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][std:c++latest] forgottenserver failed to build with /std:c++latest on MSVC #3947

Closed
xiaoxiao-Xu opened this issue Feb 16, 2022 · 7 comments · Fixed by #3954
Closed
Labels
question Questions that needs answering but do not require code changes

Comments

@xiaoxiao-Xu
Copy link

Hi,

The MSVC team recently added forgottenserver as part of RWC testing. And we found some errors when building forgottenserver with '/std:c++latest'. Could you please help look at this issue or provide some workarounds? Thanks in advance.

Steps to reproduce (include any configuration/script required to reproduce)

  1. git clone https://github.com/otland/forgottenserver.git F:\gitP\otland\forgottenserver
  2. cd F:\gitP\Microsoft\vcpkg
  3. bootstrap-vcpkg.bat
  4. vcpkg.exe install --recurse boost-iostreams boost-asio boost-system boost-filesystem boost-variant boost-lockfree luajit libmariadb pugixml cryptopp fmt --triplet x64-windows --clean-after-build
  5. mkdir F:\gitP\otland\forgottenserver\build_amd64 && cd build_amd64
  6. cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=F:\gitP\Microsoft\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
  7. set CL= /std:c++latest
  8. msbuild /m /p:Platform=x64 /p:Configuration=Release /p:PlatformToolset=v142 tfs.sln /t:Rebuild

Expected behaviour

forgottenserver project could build successfully under '/std:c++latest'.

Actual behaviour

build.log

outputmessage.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(443,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>'
with
[
_Other=_Refoa,
_Ty=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(443): note: see declaration of 'std::_Replace_first_parameter<_Other,_Ty>'
with
[
_Other=_Refoa,
_Ty=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818): note: see reference to class template instantiation 'std::_Get_rebind_type<_Alloc,_Refoa,void>' being compiled
with
[
_Alloc=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(727): note: see reference to alias template instantiation 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc<_Refoa>' being compiled
with
[
_Alloc=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2822): note: see reference to alias template instantiation 'std::_Rebind_alloc_t<LockfreePoolingAllocator<void,2048>,_Refoa>' being compiled
F:\gitP\otland\forgottenserver\src\outputmessage.cpp(81): note: see reference to function template instantiation 'std::shared_ptr std::allocate_shared<OutputMessage,LockfreePoolingAllocator<void,2048>,>(const _Alloc &)' being compiled
with
[
_Alloc=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(443,60): error C2061: syntax error: identifier 'type'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(540,69): error C2794: 'type': is not a member of any direct or indirect base class of 'std::_Get_rebind_type<_Alloc,_Refoa,void>'
with
[
_Alloc=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): error C2938: 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc' : Failed to specialize alias template
with
[
_Alloc=LockfreePoolingAllocator<void,2048>
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): error C2938: 'std::_Rebind_alloc_t' : Failed to specialize alias template
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2824,48): error C2641: cannot deduce template arguments for 'std::_Alloc_construct_ptr'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): error C2893: Failed to specialize function template 'std::_Alloc_construct_ptr<_Alloc> std::_Alloc_construct_ptr(_Alloc &)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(997): note: see declaration of 'std::_Alloc_construct_ptr'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): note: With the following template arguments:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): note: '_Alloc=_Alblock'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): error C2784: 'std::_Alloc_construct_ptr<_Alloc> std::_Alloc_construct_ptr(std::_Alloc_construct_ptr<_Alloc>)': could not deduce template argument for 'std::_Alloc_construct_ptr<_Alloc>' from '_Alblock'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(992): note: see declaration of 'std::_Alloc_construct_ptr'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): error C2784: 'std::_Alloc_construct_ptr<_Alloc> std::_Alloc_construct_ptr(std::_Alloc_construct_ptr<_Alloc>)': could not deduce template argument for 'std::_Alloc_construct_ptr<_Alloc>' from '_Alblock'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\xmemory(992): note: see declaration of 'std::_Alloc_construct_ptr'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2828,51): error C2672: 'addressof': no matching overloaded function found
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2828,16): error C2737: '_Ptr': const object must be initialized
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\memory(2818,1): error C3536: '_Ptr': cannot be used before it is initialized

Environment

Operating System: Windows server 2019
Compiler: MSVC

@EPuncker EPuncker added the question Questions that needs answering but do not require code changes label Feb 16, 2022
@EPuncker
Copy link
Contributor

have you tried using /std:c++17 ? that is the one tfs is using lately

@xiaoxiao-Xu
Copy link
Author

Yes, it compiles passed using /std:c++17, but /std:c++latest doesn't work.

EPuncker added a commit that referenced this issue Feb 17, 2022
@EPuncker
Copy link
Contributor

@xiaoxiao-Xu can you please check #3954 ?

@soul4soul
Copy link
Contributor

@xiaoxiao-Xu What is RWC testing? I see overtime MS team has opened several issues on repos across github that say the same thing.

@EPuncker
Copy link
Contributor

What is RWC testing?

RWC (real world code)

@xiaoxiao-Xu
Copy link
Author

@EPuncker Thanks for your fix. The issue has resolved.

@ranisalt
Copy link
Member

What is RWC testing?

RWC (real world code)

This is rad. So good to see our effort is noticed even outside our community :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that needs answering but do not require code changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants