소스 검색

Fix std::experimental::optional tests. Patch from Casey Carter.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275732 91177308-0d34-0410-b5e6-96231b3b80d8
Eric Fiselier 9 년 전
부모
커밋
3e732e94ae

+ 1 - 1
test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp

@@ -59,7 +59,7 @@ public:
     static bool dtor_called;
     constexpr Z() : i_(0) {}
     constexpr Z(int i) : i_(i) {}
-    constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+    Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
         {throw 6;}
     ~Z() {dtor_called = true;}
 

+ 3 - 9
test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp

@@ -59,7 +59,7 @@ class Z
 public:
     constexpr Z() : i_(0) {}
     constexpr Z(int i) : i_(i) {}
-    constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+    Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
         {throw 6;}
 
     friend constexpr bool operator==(const Z& x, const Z& y)
@@ -97,6 +97,8 @@ int main()
                 : optional<Y>(in_place, i) {}
         };
 
+        constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1});
+        static_assert(*dopt == Y{42, 101, -1}, "");
     }
     {
         static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
@@ -109,13 +111,5 @@ int main()
         {
             assert(i == 6);
         }
-
-        struct test_constexpr_ctor
-            : public optional<Z>
-        {
-            constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
-                : optional<Z>(in_place, i) {}
-        };
-
     }
 }

+ 3 - 1
test/std/experimental/optional/optional.specalg/make_optional.pass.cpp

@@ -20,6 +20,8 @@
 #include <memory>
 #include <cassert>
 
+#include "test_macros.h"
+
 int main()
 {
     using std::experimental::optional;
@@ -38,7 +40,7 @@ int main()
         std::string s("123");
         optional<std::string> opt = make_optional(std::move(s));
         assert(*opt == "123");
-        assert(s.empty());
+        LIBCPP_ASSERT(s.empty());
     }
     {
         std::unique_ptr<int> s(new int(3));

+ 1 - 1
test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp

@@ -11,7 +11,7 @@
 // <optional>
 
 // A program that necessitates the instantiation of template optional for
-// (possibly cv-qualified) null_opt_t is ill-formed.
+// (possibly cv-qualified) nullopt_t is ill-formed.
 
 #include <experimental/optional>
 

+ 1 - 1
test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp

@@ -11,7 +11,7 @@
 // <optional>
 
 // A program that necessitates the instantiation of template optional for
-// (possibly cv-qualified) null_opt_t is ill-formed.
+// (possibly cv-qualified) nullopt_t is ill-formed.
 
 #include <experimental/optional>