[stdcompat] Fix optional_test.cc for C++20

The default constructor is required here to make sure all non-static
data members are initialized (or else the assignment operators can't be
constexpr).

Test: stdcompat-tests

Change-Id: I8c69c5c1f9f8f4106d387932f8e41ba76bdcbed1
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/474406
Commit-Queue: Mark Schott <schottm@google.com>
Reviewed-by: Corey Tabaka <eieio@google.com>
Reviewed-by: Gianfranco Valentino <gevalentino@google.com>
diff --git a/sdk/lib/stdcompat/test/optional_test.cc b/sdk/lib/stdcompat/test/optional_test.cc
index 18c4c5b..602ae8b 100644
--- a/sdk/lib/stdcompat/test/optional_test.cc
+++ b/sdk/lib/stdcompat/test/optional_test.cc
@@ -222,13 +222,15 @@
 // Test trivial copy/move.
 namespace trivial_copy_move_tests {
 struct trivially_move_only {
+  constexpr trivially_move_only() = default;
+
   constexpr trivially_move_only(const trivially_move_only&) = delete;
   constexpr trivially_move_only& operator=(const trivially_move_only&) = delete;
 
   constexpr trivially_move_only(trivially_move_only&&) = default;
   constexpr trivially_move_only& operator=(trivially_move_only&&) = default;
 
-  int value;
+  int value = 0;
 };
 
 static_assert(std::is_trivially_copy_constructible<trivially_move_only>::value == false);
@@ -246,10 +248,12 @@
               true);
 
 struct trivially_copyable {
+  constexpr trivially_copyable() = default;
+
   constexpr trivially_copyable(const trivially_copyable&) = default;
   constexpr trivially_copyable& operator=(const trivially_copyable&) = default;
 
-  int value;
+  int value = 0;
 };
 
 static_assert(std::is_trivially_copy_constructible<trivially_copyable>::value == true);