Skip to content

Compiler warning with Intel compiler, same as #755 #2712

Closed
@philbucher

Description

@philbucher

Using the intel compiler reports the following warning:

#186: pointless comparison of unsigned integer with zero
          const bool is_negative = std::is_same<NumberType, number_integer_t>::value && !(x >= 0); // see issue #755

I tried the solutions posted in #755 and others (e.g. this one) but I couldn't get it to work.
I also tried with std::signed & std::unsigned but no success either

@nlohmann you could add the Intel compiler to the CI with the oneAPI
Looking at your github actions script this should be doable without too much effort. I'd be happy to help :)
You could install the compiler in what I assume is a docker image (nlohmann/json-ci:latest)

What is the issue you have?

cannot turn all warnings into errors

Please describe the steps to reproduce the issue.

Compile with ICC with e.g. Werror-all

Can you provide a small but working code example?

What is the expected behavior?

Compiles without warnings

And what is the actual behavior instead?

Warning is issued

Which compiler and operating system are you using?

  • Compiler: Intel 20.2.2.20210228 (through oneAPI)
  • Operating system: Ubuntu 20.04

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions