[clang] [clang] Fix filler handling for new expression with unspecified bound. (PR #182203)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 22 18:00:47 PST 2026


================
@@ -725,3 +725,19 @@ int (*const_fold)[12] = new int[3][&const_fold + 12 - &const_fold];
 // expected-error at -5 {{cannot allocate object of variably modified type}}
 // expected-warning at -6 {{variable length arrays in C++ are a Clang extension}}
 #endif
+
+#if __cplusplus >= 201103L
+namespace PR81157 {
+  struct C {
+    C(int);
+  };
+  int f(int n) {
+    C *ptr1{new C[]{1L}};
+    C *ptr2{new C[n]{1L}};
+    // expected-error at -1 {{no matching constructor}}
+    // expected-note at -6 {{candidate constructor}}
----------------
ojhunt wrote:

nit: use a label for the C constructor

https://github.com/llvm/llvm-project/pull/182203


More information about the cfe-commits mailing list