Skip to content

-Wsign-conversion warning to look into when compiling with emscripten em++ #4662

@vittorioromeo

Description

@vittorioromeo

Description

json.hpp:19471:23: warning: implicit conversion changes signedness: 'unsigned int' to 'difference_type' (aka 'long') [-Wsign-conversion]
 19471 |         buffer_ptr += n_chars;
       |                    ~~ ^~~~~~~
json.hpp:18995:25: note: in instantiation of function template specialization 'nlohmann::detail::serializer<nlohmann::basic_json<>>::dump_integer<unsigned long long, 0>' requested here
 18995 |                         dump_integer(val.m_data.m_value.binary->subtype());
       |                         ^
json.hpp:21308:15: note: in instantiation of member function 'nlohmann::detail::serializer<nlohmann::basic_json<>>::dump' requested here
 21308 |             s.dump(*this, true, ensure_ascii, static_cast<unsigned int>(indent));
       |               ^
mycode.cpp:447:56: note: in instantiation of member function 'nlohmann::basic_json<>::dump' requested here
  447 |     std::ofstream(filename) << nlohmann::json(profile).dump();
      |                                                        ^

Reproduction steps

N/A

Expected vs. actual results

N/A

Minimal code example

Error messages

Compiler and operating system

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.3-git (a9651ff57165f5710bb09a5fe52590fd6ddb72df) clang version 21.0.0

Library version

3.11.3

Validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions