[clang] [clang][Sema] Fix crash when checking scalar type with excess braces (PR #192471)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 7 02:52:31 PDT 2026


================
@@ -204,3 +204,50 @@ union PR4517_u {
 const union PR4517_u u1 = {4.0f};
 const union PR4517_u u2 = u1; // no-warning
 const union PR4517_u u3 = {u1.y}; // expected-error {{initializer element is not a compile-time constant}}
+
+int PR192471_1 = {{}, {}, {}}; // expected-warning {{too many braces around scalar initializer}} expected-warning {{excess elements in scalar initializer}}
+char PR192471_2[] = {
+    "1110",
+#embed __FILE__ // expected-warning {{#embed is a C23 extension}} \
+                   expected-warning {{excess elements in char array initializer}}
+};
+char PR192471_3[1] = {
+#embed __FILE__ limit(1) // expected-warning {{#embed is a C23 extension}}
----------------
Fznamznon wrote:

Thank you for adding embed tests! I think this PR is somehow related to excess braces though, so can we verify excess braces in the presence of #embed, like
https://godbolt.org/z/YEj4aKbo6
or something less fuzzer-like

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


More information about the cfe-commits mailing list