Skip to content

warnings in MSVC (2015) in 3.4.0 related to bool... #1364

@ziggurat29

Description

@ziggurat29

I just updated to 3.4.0 from 3.3.0 and some new warnings have appeared that were not present before.
They relate to 'bool'; MSVC warns if there is a integral type demoted to 'bool' type.
These were emitted in 3.3.0.

c:\experiments\sixengines\gits\forethoughtengine001\forethoughtengine001\forethoughtenginelib001\product\../srclibs/json/json.hpp(6585): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
  c:\experiments\sixengines\gits\forethoughtengine001\forethoughtengine001\forethoughtenginelib001\product\../srclibs/json/json.hpp(6557): note: while compiling class template member function 'bool nlohmann::detail::binary_reader<nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>,SAX>::parse_bson_element_internal(const int,const std::size_t)'
          with
          [
              SAX=`anonymous-namespace'::sax_lua_tbl_builder
          ]
  c:\experiments\sixengines\gits\forethoughtengine001\forethoughtengine001\forethoughtenginelib001\product\../srclibs/json/json.hpp(6650): note: see reference to function template instantiation 'bool nlohmann::detail::binary_reader<nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>,SAX>::parse_bson_element_internal(const int,const std::size_t)' being compiled
          with
          [
              SAX=`anonymous-namespace'::sax_lua_tbl_builder
          ]
  c:\experiments\sixengines\gits\forethoughtengine001\forethoughtengine001\forethoughtenginelib001\product\../srclibs/json/json.hpp(18390): note: see reference to class template instantiation 'nlohmann::detail::binary_reader<nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>,SAX>' being compiled
          with
          [
              SAX=`anonymous-namespace'::sax_lua_tbl_builder
          ]
  product\lua_runtime_setup.cpp(464): note: see reference to function template instantiation 'bool nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::sax_parse<`anonymous-namespace'::sax_lua_tbl_builder>(nlohmann::detail::input_adapter &&,SAX *,nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::input_format_t,const bool)' being compiled
          with
          [
              SAX=`anonymous-namespace'::sax_lua_tbl_builder
          ]
  product\lua_runtime_setup.cpp(464): note: see reference to function template instantiation 'bool nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::sax_parse<`anonymous-namespace'::sax_lua_tbl_builder>(nlohmann::detail::input_adapter &&,SAX *,nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::input_format_t,const bool)' being compiled
          with
          [
              SAX=`anonymous-namespace'::sax_lua_tbl_builder
          ]

As you can probably gather, I have a sax parser:

class sax_lua_tbl_builder : public nlohmann::json::json_sax_t

which I use to convert a JSON document into another form.

For the time being, I have wrapped the header like this:

#pragma warning ( push )
#pragma warning ( disable: 4800 )
#include "../srclibs/json/json.hpp"
#pragma warning ( pop )

since it seems like I can safely ignore it, but I figured you might like to know about the issue to do some sort of proper fix. Especially because this warning was NOT emitted in the previous version (3.3.0).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions