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

Different output when upgrading from clang 9 to clang 10 #2166

Closed
adrianimboden opened this issue Jun 4, 2020 · 3 comments
Closed

Different output when upgrading from clang 9 to clang 10 #2166

adrianimboden opened this issue Jun 4, 2020 · 3 comments

Comments

@adrianimboden
Copy link

What is the issue you have?

I just spent quite some time tracking down a bug caused by upgrading the compiler from clang 9.0.1 to clang 10.0. But I am not sure if that is a compiler bug or something else.
But I thought I should share it anyway here.

The following piece of code:

nlohmann::json config = {"config: {"value", {}}};
std::cerr << config.dump() << std::endl;

using clang 9.0.1 produces:

{"config": {"value": {}}}

and using clang 10.0.0 produces:

{"config": {"value": null}}

Which compiler and operating system are you using?

  • Compiler: Clang 9.0.1/10.0.0, C++17, libc++
  • Operating system: Ubuntu 20.04

Which version of the library did you use?

  • [ x ] latest release version 3.7.3
@FrancoisChabot
Copy link
Contributor

FrancoisChabot commented Jun 4, 2020

This also happens on the develop branch:
https://gcc.godbolt.org/z/937d5g

Honestly, I have no clue how clang 9.0.1 arrives at {} meaning "object", I just don't see a code path leading there at first glance. Also, considering both old and new gcc agree with clang 10.0.0, I'd be inclined to say that it's clang 9 that's wrong here.

see #2046

@nlohmann
Copy link
Owner

nlohmann commented Jun 5, 2020

This is indeed a duplicate of #2046.

@adrianimboden
Copy link
Author

Closing because of duplicate

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

No branches or pull requests

3 participants