aaron.ballman added a comment. In D155457#4511446 <https://reviews.llvm.org/D155457#4511446>, @xgupta wrote:
> In D155457#4511392 <https://reviews.llvm.org/D155457#4511392>, @aaron.ballman > wrote: > >> Whether `size_t` comes from the system header or whether it's manually >> deduced from `decltype(sizeof(0))` should make no difference as far as the >> frontend is concerned; they should resolve to the same type. Can you explain >> the test failure you're seeing in a bit more detail? > > > > : 'RUN: at line 1'; /home/shivam/.llvm/llvm-project/build/bin/clang -cc1 > -internal-isystem /home/shivam/.llvm/llvm-project/build/lib/clang/17/include > -nostdsysteminc > /home/shivam/.llvm/llvm-project/clang/test/Sema/type-limit-compare.cpp > -fsyntax-only -Wtautological-type-limit-compare -verify > -- > Exit Code: 1 > > Command Output (stderr): > -- > error: 'warning' diagnostics seen but not expected: > File > /home/shivam/.llvm/llvm-project/clang/test/Sema/type-limit-compare.cpp Line > 12: result of comparison 'uint64_t' (aka 'unsigned long long') > > 18446744073709551615 is always false > 1 error generated. > > I think the issue is with (uint64_t)(____SIZE_MAX____) vs > (uint64_t)std::numeric_limits<std::size_t>::max() but not sure. Something seems odd to me about the current behavior. Consider: https://godbolt.org/z/ofezfhaPd In the x86 compilation: `sizeof(std::size_t) < sizeof(uint64_t)` is true, so we test the other expression; because `Size` is greater than `__SIZE_MAX__` the function returns false and the second static assertion fails as expected. In the x64 compilation: `sizeof(std::size_t) < sizeof(uint64_t)` is false (first static assertion fails) so we shouldn't even be evaluating the RHS of the `&&` to see if it's tautological because it can't contribute to the expression result, right? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155457/new/ https://reviews.llvm.org/D155457 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits