Visual Studio 2017 15.5 C++17 std::allocator deprecations #872
Labels
platform: visual studio
related to MSVC
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Bug Report
Visual Studio 2017 15.5 update introduced a bunch of deprecation warnings when using C++17 feature set. It's trying to guide to better standards compliance.
When compiling a project that uses json.hpp usage of std::allocator destroy() and construct() gets flagged.
warning C4996: 'std::allocator<std::map<StringType,nlohmann::basic_jsonstd::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer,std::less,std::allocator<std::pair<const StringType,nlohmann::basic_jsonstd::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>>>>::destroy': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
warning C4996: 'std::allocator<std::map<StringType,nlohmann::basic_jsonstd::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer,std::less,std::allocator<std::pair<const StringType,nlohmann::basic_jsonstd::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>>>>::construct': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
There should be no warnings. Improve allocator usage. I have suppressed the warnings in a local fork of json.hpp and everything still works. But who knows for how long.
Which compiler and operating system are you using? Is it a [supported compiler]
Windows 10 Pro x64
Visual Studio 2017 15.5.1 professional (perhaps should be supported, I am not sure)
Did you use a released version of the library or the version from the
develop
branch?Happens on both develop of today and Version 2.1.1
The text was updated successfully, but these errors were encountered: