Closed
Description
What is the issue you have?
GCC produces a warning that statement json.hpp:8394 may fall through when preprocessor macro NDEBUG is defined.
Please describe the steps to reproduce the issue.
- Compile code example below with warning for implicit fallthrough enabled and defined preprocessor macro NDEBUG such that it uses the single-header file, eg.
g++ -Wextra -DNDEBUG <filename>
Can you provide a small but working code example?
#include <nlohmann/json.hpp>
int main() {
nlohmann::json j1 = R"({"compact": true, "schema": 0})"_json;
nlohmann::json j2 = nlohmann::json::from_msgpack(nlohmann::json::to_msgpack(j1));
return 0;
}
What is the expected behavior?
Compiler does not produce a warning, because a statement may fall through
And what is the actual behavior instead?
Compiler produces a warning, because a statement may fall through
Which compiler and operating system are you using?
- Compiler: g++ 7.5.0 / g++ 8.3.0 / g++ 10.1.0
- Operating system: Linux
Which version of the library did you use?
- latest release version 3.9.1
- other release - please state the version: ___
- the
develop
branch
If you experience a compilation error: can you compile and run the unit tests?
- yes
- no - please copy/paste the error message below