- What is the issue you have?
Code that runs in OSX with clang compiler fails in Linux Debian with gcc 4.9.2.
- Please describe the steps to reproduce the issue. Can you provide a small but working code example?
This simple code:
json data{ json::object() };
// or
json data{ json::value_t::object };
data["foo"] = 1234;
- What is the expected behavior?
It works in OSX with clang. IMHO it's supposed to work in Linux. The {} initializer is supposed to be valid.
- And what is the actual behavior instead?
It crashes with:
[json.exception.type_error.305] cannot use operator[] with a string argument with array
It works with clang: Apple LLVM version 10.0.0 (clang-1000.11.45.5) in OSX.
It fails in Linux Debian with gcc 4.9.2
- Did you use a released version of the library or the version from the
develop branch?
No. Using 3.5.0.
Important:
It works this way:
json data = json::object();
// or
json data = json::value_t::object;
// or
json data(json::value_t::object);
// or
json data(json::object());
data["foo"] = 1234;
So it looks like, when in gcc, the { } initializer is being interpreted as an array, am I right? Is this expected behavior?
Code that runs in OSX with clang compiler fails in Linux Debian with gcc 4.9.2.
This simple code:
json data{ json::object() }; // or json data{ json::value_t::object }; data["foo"] = 1234;It works in OSX with clang. IMHO it's supposed to work in Linux. The
{}initializer is supposed to be valid.It crashes with:
It works with clang: Apple LLVM version 10.0.0 (clang-1000.11.45.5) in OSX.
It fails in Linux Debian with gcc 4.9.2
developbranch?No. Using 3.5.0.
Important:
It works this way:
So it looks like, when in gcc, the
{ }initializer is being interpreted as an array, am I right? Is this expected behavior?