[clang] [C23][N3006] Documented behavior of underspecified object declarations (PR #140911)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 09:32:38 PDT 2025
================
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 -std=c23 -verify %s
+
+/* WG14 N3006: Yes
+ * Underspecified object declarations
+ */
+
+void struct_test(void) {
+ struct S1 { int x, y; }; // expected-note {{field 'x' has type 'int' here}}
+
+ auto normal_struct = (struct S1){ 1, 2 };
+ auto normal_struct2 = (struct S1) { .x = 1, .y = 2 };
+ auto underspecified_struct = (struct S2 { int x, y; }){ 1, 2 };
+ auto underspecified_struct_redef = (struct S1 { char x, y; }){ 'A', 'B'}; // expected-error {{type 'struct S1' has incompatible definitions}} \
----------------
AaronBallman wrote:
Wow, that follow-on error is gross, there's not an array in sight! Nothing to be fixed for this PR though.
https://github.com/llvm/llvm-project/pull/140911
More information about the cfe-commits
mailing list