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

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 19:57:38 PST 2022


shafik added a comment.

We may not have good code coverage, what about a case like this:

  constexpr void f() {
      int arr[10]{};
      arr[1024*1024*1024*1204];
  }

do you still obtain:

   error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  constexpr void f() {
                 ^

godbolt: https://godbolt.org/z/5T5Gn5rxq


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

https://reviews.llvm.org/D138270



More information about the cfe-commits mailing list