Skip to content

JSON_DIAGNOSTICS assertion for ordered_json #2962

Closed
@iwubcode

Description

@iwubcode

What is the issue you have?

Assertion occurs with ordered_json and JSON_DIAGNOSTICS when none is expected

Please describe the steps to reproduce the issue.

Run the working example

Can you provide a small but working code example?

#define JSON_DIAGNOSTICS 1
#include "nlohmann/json.hpp"
using json = nlohmann::ordered_json;

#include <iostream>

int main()
{
  json j;
  json j2;
  const std::string value = "";
  j["first"] = value;
  j["second"] = value;
  j2["something"] = j;
  std::cout << j2 << std::endl;
  return 0;
}

What is the expected behavior?

Assertion should not occur

And what is the actual behavior instead?

Assertion occurs

Which compiler and operating system are you using?

Tested on Visual Studio 2019 latest release. Also tested on godbolt with gcc 9.3, 11.2..

Which version of the library did you use?

3.10.0

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions