The MSVC team regularly builds JSON to detect the regressions in the compiler, recently we updated JSON source code to the latest and found this issue. In addition, the issue was not reproduced after adding the /permissive-.
Expected build successful.
unit-conversions.cpp
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1667): error C2672: 'nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get': no matching overloaded function found
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1813): note: could be 'unknown-type nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get(void) noexcept'
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1667): note: 'unknown-type nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get(void) noexcept': could not deduce template argument for '__formal'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1812): note: 'type': is not a member of any direct or indirect base class of 'std::enable_if<false,int>'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1772): note: or 'unknown-type nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get(void) noexcept(<expr>) const'
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1667): note: Failed to specialize function template 'unknown-type nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get(void) noexcept(<expr>) const'
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1667): note: With the following template arguments:
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1667): note: 'ValueTypeCV=std::filesystem::path'
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1667): note: 'ValueType=std::filesystem::path'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1774): note: 'nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get_impl': no matching overloaded function found
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1737): note: could be 'unknown-type nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get_impl(nlohmann::json_abi_v3_12_0::detail::priority_tag<4>) noexcept const'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1724): note: or 'nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void> nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get_impl(nlohmann::json_abi_v3_12_0::detail::priority_tag<3>) const'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1701): note: or 'BasicJsonType nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get_impl(nlohmann::json_abi_v3_12_0::detail::priority_tag<2>) const'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1676): note: or 'ValueType nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get_impl(nlohmann::json_abi_v3_12_0::detail::priority_tag<1>) noexcept(<expr>) const'
C:\gitP\nlohmann\json\include\nlohmann/json.hpp(1634): note: or 'ValueType nlohmann::json_abi_v3_12_0::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_12_0::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>,void>::get_impl(nlohmann::json_abi_v3_12_0::detail::priority_tag<0>) noexcept(<expr>) const'
C:\gitP\nlohmann\json\tests\src\unit-conversions.cpp(1668): error C3536: 'p': cannot be used before it is initialized
Description
Hi All,
The MSVC team regularly builds JSON to detect the regressions in the compiler, recently we updated JSON source code to the latest and found this issue. In addition, the issue was not reproduced after adding the
/permissive-.Build.log
Reproduction steps
Expected vs. actual results
Expected build successful.
Minimal code example
The problem occurs with this code: ++ json j; const json::array_t a = j; json const j_string = "Path"; auto p = j_string.template get<nlohmann::detail::std_fs::path>(); // failsError messages
Compiler and operating system
VS2026
Library version
3ed64e5
Validation
developbranch is used.