[clang] [clang] Improve diagnostics with incompatible VLA types (PR #101261)
Andrew Sukach via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 20 05:05:02 PDT 2024
================
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void func(int n) {
+ int grp[n][n];
+ int (*ptr)[n];
+
+ for (int i = 0; i < n; i++)
+ ptr = &grp[i]; // expected-error {{incompatible assignment of pointers of variable-length array type 'int (*)[n]'; consider using a typedef to use the same variable-length array type for both operands}}
+}
----------------
sookach wrote:
Just out of curiosity, what does the new line do? or is it just a formatting thing?
https://github.com/llvm/llvm-project/pull/101261
More information about the cfe-commits
mailing list