[clang] Diagnose potential size confusion with VLA params [contd.] (PR #181550)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 08:56:12 PST 2026


================
@@ -229,6 +229,14 @@ def err_vla_in_coroutine_unsupported : Error<
   "variable length arrays in a coroutine are not supported">;
 def note_vla_unsupported : Note<
   "variable length arrays are not supported for the current target">;
+def warn_vla_size_expr_shadow : Warning<"variable length array size expression "
+                                        "refers to declaration from an outer "
+                                        "scope">,
+                                InGroup<VLASizeConfusion>;
+def note_vla_size_expr_shadow_param
+    : Note<"does not refer to this declaration">;
+def note_vla_size_expr_shadow_actual
+    : Note<"refers to this declaration instead">;
----------------
AaronBallman wrote:

```suggestion
def warn_vla_size_expr_shadow : Warning<
  "variable length array size expression refers to declaration from an outer "
  "scope">,  InGroup<VLASizeConfusion>;
def note_vla_size_expr_shadow_param : Note<
  "does not refer to this declaration">;
def note_vla_size_expr_shadow_actual : Note<
  "refers to this declaration instead">;
```
clang-format does bad things to our .td files sometimes, so this is just a reformat.

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


More information about the cfe-commits mailing list