[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 19 05:50:07 PDT 2024
================
@@ -142,7 +142,7 @@ constexpr int arb(int n) { // expected-note {{declared here}}
expected-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
}
constexpr long Overflow[(1 << 30) << 2]{}; // expected-warning {{requires 34 bits to represent}} \
- expected-warning {{variable length array folded to constant array as an extension}} \
+ expected-error {{variable length array declaration not allowed at file scope}} \
----------------
AaronBallman wrote:
Perhaps we should file an issue to come back and improve consistency here in the future? The behavior is likely mysterious from a user perspective.
In terms of losing the extension, I think it's unlikely to cause significant disruption for anyone so I don't think it needs to be addressed immediately.
https://github.com/llvm/llvm-project/pull/99579
More information about the cfe-commits
mailing list