简体   繁体   中英

Clang libtooling header errors

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM