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

C2864 error when compiling with VS2015 and VS 2017 #903

Closed
xelatihy opened this issue Jan 5, 2018 · 3 comments
Closed

C2864 error when compiling with VS2015 and VS 2017 #903

xelatihy opened this issue Jan 5, 2018 · 3 comments
Labels
platform: visual studio related to MSVC state: needs more info the author of the issue needs to provide more details

Comments

@xelatihy
Copy link

xelatihy commented Jan 5, 2018

Bug Report

I have several compiler errors of type C2864 when compiling of both VS2015 and VS2017. Using cmake build script with C++14 as required version.

I am using AppVeyor to build my app since I do not have a local Windows install, so I cannot verify whether it builds with your CMake.

First error is in
/json.hpp(812): error C2864: 'nlohmann::detail::has_mapped_type::value': a static data member with an in-class initializer must have non-volatile const integral type

@nlohmann
Copy link
Owner

nlohmann commented Jan 5, 2018

That is strange, because the project compiles without problems on AppVeyor, see https://ci.appveyor.com/project/nlohmann/json. You may want to check the flags set in the CMakefile, because this seems to be the only difference to your project.

@nlohmann nlohmann added platform: visual studio related to MSVC state: needs more info the author of the issue needs to provide more details labels Jan 5, 2018
@xelatihy
Copy link
Author

xelatihy commented Jan 5, 2018

I was able to track down the problem to an inclusion that fiddle with constexpr behaviour to fix it for non standard MSVC 2015 issues. It had nothing to do with your code, but showed up there (strangely enough). I am closing this. Thanks.

@xelatihy xelatihy closed this as completed Jan 5, 2018
@gutwinski
Copy link

@xelatihy , can you please give details about your solution? I think that I have come across a similar issue with MSVC 2015 Professional. I get this error:

error C4579: 'nlohmann::detail::static_const<nlohmann::detail::from_json_fn>::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported

It references the following code of cpp_future.hpp:

// taken from ranges-v3
template<typename T>
struct static_const
{
    static constexpr T value{};
};

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: visual studio related to MSVC state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

3 participants