Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile warnings on MSVC 14.2 #1911

Closed
paamand opened this issue Jan 21, 2020 · 7 comments · Fixed by #1967 or #1969
Closed

Compile warnings on MSVC 14.2 #1911

paamand opened this issue Jan 21, 2020 · 7 comments · Fixed by #1967 or #1969
Assignees
Labels
kind: bug platform: visual studio related to MSVC solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Milestone

Comments

@paamand
Copy link

paamand commented Jan 21, 2020

After upgrading from Visual Studio 17 to 19 i get the following compile warnings:

Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
.\nlohmann\detail\conversions\to_chars.hpp 993
(also line 997, 1007, 1009, 1017, 1021, 1036 and 1038)

Warning C26444 Avoid unnamed objects with custom construction and destruction (es.84).
.\nlohmann\detail\input\json_sax.hpp 443

Warning C28020 The expression '0<=_Param_(1)&&_Param_(1)<=400-1' is not true at this call.
.\nlohmann\detail\output\serializer.hpp 804

Warning C26451 Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).
.\nlohmann\detail\output\serializer.hpp 810

Warning C26495 Variable 'nlohmann::basic_json<std::map,std::vector,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,bool,__int64,unsigned __int64,double,std::allocator,nlohmann::adl_serializer>::m_type' is uninitialized. Always initialize a member variable (type.6).
.\nlohmann\json.hpp 1777

@nlohmann nlohmann added the platform: visual studio related to MSVC label Jan 25, 2020
@stale
Copy link

stale bot commented Feb 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Feb 24, 2020
@stale stale bot closed this as completed Mar 3, 2020
@dota17
Copy link
Contributor

dota17 commented Mar 3, 2020

Bad bot

@dota17
Copy link
Contributor

dota17 commented Mar 3, 2020

  1. C26495 in json.hpp

Warning C26495 Variable 'nlohmann::basic_json<std::map,std::vector,std::basic_string<char,std::char_traits,std::allocator >,bool,__int64,unsigned __int64,double,std::allocator,nlohmann::adl_serializer>::m_type' is uninitialized. Always initialize a member variable (type.6).
.\nlohmann\json.hpp 1777

value_t m_type = value_t::null;

Unfortunately, I didn't got this warning in my VS2019. And i think the value m_type has been initialized.

  1. C26444 in json_sax.hpp

Warning C26444 Avoid unnamed objects with custom construction and destruction (es.84).
.\nlohmann\detail\input\json_sax.hpp 443

I think this is a C26444 false positive.

@nlohmann nlohmann reopened this Mar 13, 2020
@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Mar 13, 2020
@nlohmann
Copy link
Owner

Any idea how to proceed here?

@bhardwajs
Copy link

@nlohmann - I can take a look and send PR. However, I will be using the latest VS 16.5.3. Would that be okay or do you want to check for the specific VS instance?

@ArtemSarmini
Copy link
Contributor

VS 16.5 should be compatible with older 16.X.

@nlohmann
Copy link
Owner

Yes, PRs welcome!

@nlohmann nlohmann linked a pull request Apr 17, 2020 that will close this issue
4 tasks
@nlohmann nlohmann linked a pull request Apr 17, 2020 that will close this issue
@nlohmann nlohmann added solution: proposed fix a fix for the issue has been proposed and waits for confirmation and removed state: waiting for PR labels Apr 17, 2020
@nlohmann nlohmann self-assigned this Apr 17, 2020
@nlohmann nlohmann added this to the Release 3.8.0 milestone Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug platform: visual studio related to MSVC solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
5 participants