[clang] [Clang] Diagnose require_explicit_initialization for C tentative definitions (PR #234210)

Pathri Vidya Praveen via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 06:57:04 PDT 2026


================
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -std=c17 -fsyntax-only -Wuninitialized-explicit-init -verify %s
+// RUN: %clang_cc1 -std=c23 -fsyntax-only -Wuninitialized-explicit-init -verify %s
+
+struct ops {
+    int (*show)(void) __attribute__((require_explicit_initialization)); // #SHOW
+    int flags;
+};
+
+struct plain {
+    int a;
+};
+
+struct plain no_attribute; // no warning: no field requires explicit initialization
+
+struct ops never_completed; // expected-warning {{field in 'ops' requires explicit initialization but is not explicitly initialized}} expected-note@#SHOW {{'show' declared here}}
----------------
PathriVidyaPraveen wrote:

Done, thanks!

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


More information about the cfe-commits mailing list