Reputation: 97
My project which uses clang-libtooling fails to compile due to errors that come form the headers.
The error is: C:\llvm\llvm\include\llvm\Support\MathExtras.h(372,31): error C4146: unary minus operator applied to unsigned type, result still unsigned
, the associated code in the library header is:
/// Gets the minimum value for a N-bit signed integer.
inline int64_t minIntN(int64_t N) {
assert(N > 0 && N <= 64 && "integer width out of range");
return -(UINT64_C(1)<<(N-1));
}
I fail to see how this should compile ever, but it did a while ago. It is probably the result of my code somehow, but I tried compiling and empty program with just the headers included and it still failed like this. Any idea how to fix this issue?
Upvotes: 0
Views: 257
Reputation: 94
First of all, you should report the error to llvm.org. C4146 is a warning turned into an error by the -sdl
compiler option, which I believe is a default (always on) option. Remove the compiler option and the error will become a warning and the code will compile.
Upvotes: 0