================ @@ -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 pointer types assigning to 'int (*)[n]' from 'int (*)[n]'; VLA types differ despite using the same array size expression}} ---------------- AaronBallman wrote:
Some other good tests to add would be: ``` void func(int n, int (&array)[n]) { int (&other)[n] = array; } template <typename T> void foo(T &, T &); void bar(int n) { int array[n]; int other[n]; foo(array, other); } void quux(int n) { int (*array)[n]; int (*array)[n]; } ``` there are probably other good test cases to add (take a look for `%diff` in `DiagnosticSemaKinds.td` for inspiration), if you want to try for more. https://github.com/llvm/llvm-project/pull/101261 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits