jsoncons icon indicating copy to clipboard operation
jsoncons copied to clipboard

Visual Studio 2022 Preview 17.4.0 compilation errors

Open lorteddie opened this issue 2 years ago • 1 comments

Describe the bug

Updating visual studio to preview 17.4.0 produces compilations errors upon basically any include of jsoncons.

1>V:\code\jsoncons-0-168-7\include\jsoncons\converter.hpp(282,37): error C2039: 'from': is not a member of 'jsoncons::converter<std::basic_string<char,std::char_traits,std::allocator>,void>' 1>V:\code\jsoncons-0-168-7\include\jsoncons\converter.hpp(281): message : see declaration of 'jsoncons::converter<std::basic_string<char,std::char_traits,std::allocator>,void>' 1>V:\code\jsoncons-0-168-7\include\jsoncons\converter.hpp(279,9): message : This diagnostic occurred in the compiler generated function 'std::enable_if<!jsoncons::type_traits::is_byte<ChT,void>::value,void>::type jsoncons::converter<Into,std::enable_if<jsoncons::type_traits::is_basic_string<Into,void>::value,void>::type>::from_(Into &,const jsoncons::byte_string_view &,jsoncons::semantic_tag,std::error_code &) const' 1>V:\code\jsoncons-0-168-7\include\jsoncons\converter.hpp(291): message : see reference to class template instantiation 'jsoncons::converter<Into,std::enable_if<jsoncons::type_traits::is_basic_string<Into,void>::value,void>::type>' being compiled

Enumerate the steps to reproduce the bug #include <jsoncons/json.hpp>

Include a small, self-contained example if possible #include <jsoncons/json.hpp>

What compiler, architecture, and operating system?

  • Compiler: Visual Studio Preview 17.40.0
  • Architecture (e.g. x86, x64) x64
  • Operating system: Windows 10

What jsoncons library version?

  • [./ ] Latest release 0.168.7
  • [ ] Other release ______
  • [ ] master

lorteddie avatar Aug 09 '22 19:08 lorteddie

Thanks for reporting this, I'll have a look at the preview.

danielaparker avatar Aug 17 '22 15:08 danielaparker

It appears to be an issue of a converter<Into> specialization defined after its first use. This is the first time I've seen a compiler complain about this, but after investigating and discussing on a C++ forum, I think Visual Studio Preview 17.40.0 is right.

I've rewritten the converter class, the code is on master, and Visual Studio Preview 17.40.0 is now able to compile. This fix will go in the next release.

danielaparker avatar Oct 04 '22 20:10 danielaparker

Fixed in 0.169.0

danielaparker avatar Nov 02 '22 12:11 danielaparker