[clang-tools-extra] [clang-tidy] Fix false positive in modernize-use-equals-default (PR #232363)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 03:48:17 PDT 2026


================
@@ -269,6 +293,35 @@ struct DCNE : KW {
   // CHECK-FIXES: DCNE() noexcept = default;
 };
 
+// Delegating constructor with zero-init of an array of class type.
+struct DCNA {
+  DCNA() : entries() {}
+  // defaulting would remove the zero-init of entries.
+  non_empty entries[32];
+};
+
+// Zero-init of an array of scalars.
+struct DCNS {
+  DCNS() : buf() {}
+  // defaulting would remove the zero-init of buf.
+  unsigned buf[8];
+};
+
+// Same for a plain scalar member.
+struct DCNSM {
+  DCNSM() : x() {}
+  // defaulting would remove the zero-init of x.
+  int x;
----------------
zwuis wrote:

Can you add tests with `int x = 1;`?

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


More information about the cfe-commits mailing list