================ @@ -0,0 +1,84 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s readability-use-numeric-limits %t +#include <stdint.h> + +void constants() { + // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: The constant -128 is being utilized. Consider using std::numeric_limits<int8_t>::min() instead [readability-use-numeric-limits] + // CHECK-FIXES: int8_t _ = std::numeric_limits<int8_t>::min(); + int8_t _ = -128; + + // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: The constant 127 is being utilized. Consider using std::numeric_limits<int8_t>::max() instead [readability-use-numeric-limits] + // CHECK-FIXES: int8_t _ = std::numeric_limits<int8_t>::max(); + int8_t _ = +127; ---------------- vbvictor wrote:
Please, don't use placeholder variables in test files. Although it is already supported in gcc14 and clang18, I believe tests which say `c++11-or-later` should be able to compile with any compiler which has `c++11` support. https://github.com/llvm/llvm-project/pull/127430 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits