[clang] [clang][C23] N3006 Underspecified object declarations (PR #79845)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 14:45:44 PDT 2024


================
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c2x -verify %s
+
+/* WG14 N3006: Full
+ * Underspecified object declarations
+ */
+
+struct S1 { int x, y; };        // expected-note {{previous definition is here}}
+union U1 { int a; double b; };  // expected-note {{previous definition is here}}
+enum E1 { FOO, BAR };           // expected-note {{previous definition is here}}
+
+auto normal_struct = (struct S1){ 1, 2 };
----------------
nickdesaulniers wrote:

consider adding a test using compound literals

```c
auto normal_struct2 = (struct S1) { .x = 1, .y = 2 };
```
(I'm surprised we don't currently support this (`normal_struct2` or `normal_struct`).  That alone seems like an improvement.

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


More information about the cfe-commits mailing list