-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Description
- What is the issue you have?
Compiling in downstream projects with -Wshadow warns on void merge_patch(const basic_json& patch) shadowing a member of this.
https://github.com/nlohmann/json/blob/master/include/nlohmann/json.hpp#L7866
- Please describe the steps to reproduce the issue. Can you provide a small but working code example?
Compile with Clang 5.0.0 and CXXFLAGS="-Wshadow".
- What is the expected behavior?
Better not to shadow a member of this :)
- And what is the actual behavior instead?
Throws a warning, e.g.: https://travis-ci.org/openPMD/openPMD-api/jobs/449795263
single_include/nlohmann/json.hpp:
In member function ‘void nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::merge_patch(const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&)’:
single_include/nlohmann/json.hpp:20126:5: error: declaration of ‘patch’ shadows a member of 'this' [-Werror=shadow]
{
- Which compiler and operating system are you using? Is it a supported compiler?
Clang 5.0.0 on Travis CI (Ubuntu 14.04)
- Did you use a released version of the library or the version from the
developbranch?
We use release 3.4.0.
- If you experience a compilation error: can you compile and run the unit tests?
N/A
first seen by @franzpoeschel
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels