aaron.ballman added a comment.

In D138270#3956221 <https://reviews.llvm.org/D138270#3956221>, @tbaeder wrote:

> 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.

The downside to losing that warning is that passing `-Wno-invalid-constexpr` 
will lose the diagnostic entirely, which seems like a regression.



================
Comment at: clang/include/clang/Sema/Sema.h:3514-3517
+  bool curFunctionDeclIsConstexpr() const {
+    const FunctionDecl *FD = getCurFunctionDecl();
+    return FD ? FD->isConstexpr() : false;
+  }
----------------
You should add some documentation comments to the function.

One slight worry I have here is with dependent (perhaps special) member 
functions; is this function meant to answer "is this function callable in a 
constexpr context" or is it meant to answer "did the user specify this as a 
constexpr function"?

e.g.,
```
template <int N>
constexpr int func(int Val) { return Val / N; } // Not yet instantiated.
```


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

https://reviews.llvm.org/D138270

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to