================
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-unknown-unknown \
+// RUN: -fmax-init-list-elements=4 %s
+
+int designated_at_limit[] = { [3] = 1 };
+_Static_assert(sizeof(designated_at_limit) / sizeof(int) == 4, "");
+
+int range_at_limit[] = { [1 ... 3] = 1 };
+_Static_assert(sizeof(range_at_limit) / sizeof(int) == 4, "");
+
+int designated_over_limit[] = {
+ [4] = 1, // expected-error {{array is too large (5 elements)}}
----------------
AaronBallman wrote:
Agreed, the diagnostic should help the user understand why the array is too
large. Maybe something like:
`array is too large (5 elements, '-fmax-init-list-elements' is 4)` or similar?
And if nothing is specified on the command line, perhaps that's a different
diagnostic along the lines of `array designated initializer too large to
support` or something? It's not that we can't support it, it's that we choose
not to?
https://github.com/llvm/llvm-project/pull/205503
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits