Closed tesla1060 closed 1 year ago
I am wonder why below code can be compiled
#include "json.hpp" #include <iostream> using json = nlohmann::json; std::tuple<bool, json> test() { json j; j["name"]="a"; return std::make_tuple(true, j); } int main() { json j; j = test(); std::cout << j.contains("name") << std::endl; }
code supplied description.
I am expecting a compile time failure, while the above code can actually compiled and run
No response
ubuntu 20
gcc 9
develop
See https://json.nlohmann.me/api/macros/json_use_implicit_conversions/
Can you try to compile with
#define JSON_USE_IMPLICIT_CONVERSIONS 0
Description
I am wonder why below code can be compiled
Reproduction steps
code supplied description.
Expected vs. actual results
I am expecting a compile time failure, while the above code can actually compiled and run
Minimal code example
No response
Error messages
No response
Compiler and operating system
ubuntu 20
Library version
gcc 9
Validation
develop
branch is used.