- What is the issue you have?
When building v3.6.0 or v3.6.1 I get the following error from a unit-conversion test. The error is not present when building v3.5.0.
[ 46%] Building CXX object _deps/nlohmann_json-build/test/CMakeFiles/test-conversions.dir/src/unit-conversions.cpp.o
/tmp/tmp.KVk3RBpMpy/cmake-build-debug/_deps/nlohmann_json-src/test/src/unit-conversions.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____0()':
/tmp/tmp.KVk3RBpMpy/cmake-build-debug/_deps/nlohmann_json-src/test/src/unit-conversions.cpp:483:34: error: conversion from 'nlohmann::json' {aka 'nlohmann::basic_json<>'} to non-scalar type 'std::string_view' {aka 'std::basic_string_view<char>'} requested
std::string_view s = j;
- Please describe the steps to reproduce the issue. Can you provide a small but working code example?
Include nlohmann_json in a Cmake project using FetchContent:
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.6.1
)
FetchContent_MakeAvailable(nlohmann_json)
include_directories(${nlohmann_json_SOURCE_DIR}/single_include)
- What is the expected behavior?
Tests pass without errors.
- And what is the actual behavior instead?
The above error occurs.
Ubuntu 18.04 with GCC 8.3.0.
Using C++17.
- Did you use a released version of the library or the version from the
develop branch?
The test error occurs with v3.6.0 and v3.6.1. It does not occur with v3.5.0. I haven't tested any other versions.
See above.
When building v3.6.0 or v3.6.1 I get the following error from a unit-conversion test. The error is not present when building v3.5.0.
Include nlohmann_json in a Cmake project using
FetchContent:Tests pass without errors.
The above error occurs.
Ubuntu 18.04 with GCC 8.3.0.
Using C++17.
developbranch?The test error occurs with v3.6.0 and v3.6.1. It does not occur with v3.5.0. I haven't tested any other versions.
See above.