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

Uniform initialization from another json object differs between gcc and clang. #985

Closed
dsiroky opened this issue Feb 27, 2018 · 2 comments
Closed
Labels
solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)

Comments

@dsiroky
Copy link

dsiroky commented Feb 27, 2018

Construction behaves differently with gcc 7.2 and clang 5.

Code to reproduce:

auto j1{nlohmann::json::parse("5")};
auto j2 = nlohmann::json::parse("5");
std::cout << j1.is_array() << '\n';
std::cout << j2.is_array() << '\n';

gcc prints:
1
0

clang prints:
0
0

Both are nlohmann::json instances however j1 has an array wrapped around in gcc.

@theodelrieu
Copy link
Contributor

IIRC the auto i{2} form has been fixed in C++17, before it would deduce to std::initializer_list instead of int.

I guess this is the same thing here. If you enable more warnings you should see Clang tell you something like "the meaning of this initialization will change in the future".

My recommendation would be to not use it at all, uniform initialization is quite borken :/

@nlohmann
Copy link
Owner

I fear there is nothing we can do about this. :-/

@nlohmann nlohmann added the solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope) label Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)
Projects
None yet
Development

No branches or pull requests

3 participants