[PATCH] D138270: [clang][Sema] Skip checking int expressions for overflow in constexpr functions

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 00:36:48 PST 2022


tbaeder added a comment.

Output for that test case is:

  ./array.cpp:1:16: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  constexpr void f() {
                 ^
  ./array.cpp:3:23: note: value 1292785156096 is outside the range of representable values of type 'int'
      arr[1024*1024*1024*1204];
                        ^
  ./array.cpp:3:28: warning: expression result unused [-Wunused-value]
      arr[1024*1024*1024*1204];
      ~~~ ~~~~~~~~~~~~~~~~~~~^
  1 warning and 1 error generated.

The first overflow warning is missing. That seems to be new though, I don't get that warning with clang 14 either.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138270/new/

https://reviews.llvm.org/D138270



More information about the cfe-commits mailing list