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

warning STL4010: Various members of std::allocator are deprecated in C++17 #1683

Closed
risa2000 opened this issue Jul 11, 2019 · 1 comment · Fixed by #1720
Closed

warning STL4010: Various members of std::allocator are deprecated in C++17 #1683

risa2000 opened this issue Jul 11, 2019 · 1 comment · Fixed by #1720

Comments

@risa2000
Copy link

I am leaving it here for the record as I have been facing it in both VS 2017 and VS 2019 Community versions recently. When building a simple test code:

//#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING

#include <xtensor/xarray.hpp>

int main(int argc, char* argv[])
{
    xt::xarray<double> test = { 1.0, 0.5, 0.1, 0.001, 0.0001 };
    return 0;
}

with /std:c++17 the compiler produces a heap of warnings of the type:

warning STL4010: Various members of std::allocator are deprecated in C++17

This is related to the deprecated allocator implementation in C++17 (as detailed here https://devblogs.microsoft.com/cppblog/c17-feature-removals-and-deprecations/).

The warnings can be masked by the #define, but it seems to be only temporary solution.

Incidentally, I have noticed that some other projects already addressed this problem (e.g. nlohmann/json#872) and the fix seems to be rather light, but I am not that familiar with the STL to propose the fix myself.

The test code build log for the reference (from ninja) is here:
xtest.build.log

@JohanMabille
Copy link
Member

Thanks for reporting this issue!

Indeed the fix seems quite simple, some calls must be replaced with indirect calls through allcator_traits

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

Successfully merging a pull request may close this issue.

2 participants