]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/experimental/optional/cons/value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / experimental / optional / cons / value.cc
index 920b79607295a6bbf2c10b344cab1a678f46b896..9c3d9cd50fbdc5f90f1d1f6b928eae626fe7b0aa 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do run { target c++14 } }
 
-// Copyright (C) 2013-2016 Free Software Foundation, Inc.
+// Copyright (C) 2013-2024 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -13,7 +13,7 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 
-// You should have received a moved_to of the GNU General Public License along
+// You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
@@ -254,4 +254,31 @@ int main()
     std::experimental::optional<X> ox4;
     ox4 = oi;
   }
+
+  {
+    std::experimental::optional<std::experimental::optional<int>> ooi =
+      std::experimental::optional<int>();
+    VERIFY(bool(ooi));
+    ooi = std::experimental::optional<int>();
+    VERIFY(bool(ooi));
+    ooi = std::experimental::optional<int>(42);
+    VERIFY(bool(ooi));
+    VERIFY(bool(*ooi));
+    std::experimental::optional<std::experimental::optional<int>> ooi2 =
+      std::experimental::optional<short>();
+    VERIFY(bool(ooi2));
+    ooi2 = std::experimental::optional<short>();
+    VERIFY(bool(ooi2));
+    ooi2 = std::experimental::optional<short>(6);
+    VERIFY(bool(ooi2));
+    VERIFY(bool(*ooi2));
+    std::experimental::optional<std::experimental::optional<int>> ooi3 =
+      std::experimental::optional<int>(42);
+    VERIFY(bool(ooi3));
+    VERIFY(bool(*ooi3));
+    std::experimental::optional<std::experimental::optional<int>> ooi4 =
+      std::experimental::optional<short>(6);
+    VERIFY(bool(ooi4));
+    VERIFY(bool(*ooi4));
+  }
 }