[libcxx-commits] [libcxx] [libc++][test] Add default member initializers to `TestCaseMapSet` (PR #107145)

Casey Carter via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 3 12:32:27 PDT 2024


https://github.com/CaseyCarter created https://github.com/llvm/llvm-project/pull/107145

These do-nothing initializers (`Buffer<T>` is fully initialized, so value-init and default-init are equivalent) silence Clang 18 `-Wmissing-field-initializers` warnings when the functions in the same header use designated initializers for `TestCaseMapSet`. (Clang 19+ doesn't emit this warning for designated initializers.)

>From 312ac2252d27e1bf837622f84839069f90f1dee0 Mon Sep 17 00:00:00 2001
From: Casey Carter <cacarter at microsoft.com>
Date: Tue, 3 Sep 2024 11:23:23 -0700
Subject: [PATCH] [libc++][test] Add default member initializers to
 `TestCaseMapSet`

These do-nothing initializers (`Buffer<T>` is fully initialized, so value-init and default-init are equivalent) silence Clang 18 `-Wmissing-field-initializers` warnings when the functions in the same header use designated initializers for `TestCaseMapSet`. (Clang 19+ doesn't emit this warning for designated initializers.)
---
 libcxx/test/std/containers/insert_range_maps_sets.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/test/std/containers/insert_range_maps_sets.h b/libcxx/test/std/containers/insert_range_maps_sets.h
index 82fea93b68fe37..78af8ac66aacc8 100644
--- a/libcxx/test/std/containers/insert_range_maps_sets.h
+++ b/libcxx/test/std/containers/insert_range_maps_sets.h
@@ -70,10 +70,10 @@ constexpr bool test_map_constraints_insert_range() {
 
 template <class T>
 struct TestCaseMapSet {
-  Buffer<T> initial;
-  Buffer<T> input;
-  Buffer<T> expected;
-  Buffer<T> expected_multi;
+  Buffer<T> initial{};
+  Buffer<T> input{};
+  Buffer<T> expected{};
+  Buffer<T> expected_multi{};
 };
 
 // Empty container.



More information about the libcxx-commits mailing list