================
@@ -1069,6 +1069,32 @@ namespace BaseCompare {
static_assert(foo());
}
+
+namespace NegativeArraySize {
+
+constexpr void f() {
+ int x = -1;
+ int *p = new int[x]; // expected-note {{cannot allocate array with negative
size in a constant expression}}
+}
+// both-error@-4 {{constexpr function never produces a constant expression}}
----------------
snarang181 wrote:
Yes, it shows up when the function is called.
https://github.com/llvm/llvm-project/pull/155737
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits