Menu

[MSVC] Cppcheck failed due to error C2039, error C2938, error C2061, and error C2955 with option /std:c++latest

June Liu
2023-05-09
2023-05-10
  • June Liu

    June Liu - 2023-05-09

    Hi,
    Recently, we updated the commit of Cppcheck, and it built failed due to the errors like below. Could you please take a look? Thanks.

    C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2061: syntax error: identifier 'type' (compiling source file astutils.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2027: use of undefined type 'std::_Replace_first_parameter<_Other,_Ty>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(564,69): error C2794: 'type': is not a member of any direct or indirect base class of 'std::_Get_rebind_type<_Alloc,_Ty,void>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(766,69): error C2938: 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc' : Failed to specialize alias template [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\vector(444,26): error C2938: 'std::_Rebind_alloc_t' : Failed to specialize alias template (compiling source file astutils.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2061: syntax error: identifier 'type' (compiling source file checkcondition.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2061: syntax error: identifier 'type' (compiling source file checkbufferoverrun.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(564,69): error C2794: 'type': is not a member of any direct or indirect base class of 'std::_Get_rebind_type<_Alloc,_Ty,void>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\vector(455,52): error C2955: 'std::allocator_traits': use of class template requires template argument list (compiling source file astutils.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(564,69): error C2794: 'type': is not a member of any direct or indirect base class of 'std::_Get_rebind_type<_Alloc,_Ty,void>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(453,66): error C2061: syntax error: identifier 'type' (compiling source file checkleakautovar.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(766,69): error C2938: 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc' : Failed to specialize alias template [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\vector(455,52): error C2039: 'pointer': is not a member of 'std::allocator_traits<_Alloc>' (compiling source file astutils.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(766,69): error C2938: 'std::_Normal_allocator_traits<_Alloc>::rebind_alloc' : Failed to specialize alias template [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\xmemory(564,69): error C2794: 'type': is not a member of any direct or indirect base class of 'std::_Get_rebind_type<_Alloc,_Ty,void>' [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\vector(444,26): error C2938: 'std::_Rebind_alloc_t' : Failed to specialize alias template (compiling source file checkcondition.cpp) [F:\gitP\danmar\cppcheck\lib\cppcheck.vcxproj]

    Excepted result:
    build successfully.

    Repro steps:
    1. git clone https://github.com/danmar/cppcheck F:\gitP\danmar\cppcheck
    2. git -C "F:\gitP\danmar\cppcheck" reset --hard 173c843
    3. set _CL_= /std:c++latest
    4. cd F:\gitP\danmar\cppcheck
    5. devenv /upgrade cppcheck.sln
    6. msbuild /m /p:Platform=x64 /p:Configuration=Release cppcheck.sln /t:Rebuild

    More info:
    Windows: windows server 2022
    VS: VS2022 (vs17.5.4)

     

    Last edit: June Liu 2023-05-09
  • CHR

    CHR - 2023-05-09

    It works for me with current head and without /std:c++latest.
    The project still uses C++11, although MSVC defaults to C++14.

     
    • June Liu

      June Liu - 2023-05-10

      Thanks for your reply. Now we add option /D_HAS_DEPRECATED_ALLOCATOR_MEMBERS to workaround it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.