Skip to content

Warning C4866: compiler may not enforce left-to-right evaluation order for call to 'Json::Value::operator[] #1687

@MaikeR-TV

Description

@MaikeR-TV

Describe the bug
Updating jsoncpp from 1.9.6 to 1.9.7 introduces warning C4866: compiler may not enforce left-to-right evaluation order for call to 'Json::Value::operator[]' on MSVC.

To Reproduce
Treating warnings as errors.
Following code examples:

Json::StreamWriterBuilder writer;
writer.settings_["indentation"] = "";
std::string TokenName("Token");
myToken = jsonRoot[TokenName].asString();

(especially in a function where jsonRoot it const ref)

Expected behavior
With a minor version change, I don't expect big changes that introduce new warnings and require changes on consumer side.

Desktop:

  • OS: Windows
  • Ninja version 1.11.1

Additional context
While there are possibilities to use find(), or get() or myToken = jsonRoot[Json::StaticString(TokenName)].asString();, this requires many changes in our code base and we'd appreciate if the operator [] could be used as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions