[libcxx] r275732 - Fix std::experimental::optional tests. Patch from Casey Carter.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 17 13:32:30 PDT 2016
Author: ericwf
Date: Sun Jul 17 15:32:30 2016
New Revision: 275732
URL: http://llvm.org/viewvc/llvm-project?rev=275732&view=rev
Log:
Fix std::experimental::optional tests. Patch from Casey Carter.
Modified:
libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
libcxx/trunk/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp
libcxx/trunk/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
libcxx/trunk/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
Modified: libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp?rev=275732&r1=275731&r2=275732&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp Sun Jul 17 15:32:30 2016
@@ -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;}
Modified: libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp?rev=275732&r1=275731&r2=275732&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp Sun Jul 17 15:32:30 2016
@@ -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) {}
- };
-
}
}
Modified: libcxx/trunk/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp?rev=275732&r1=275731&r2=275732&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.specalg/make_optional.pass.cpp Sun Jul 17 15:32:30 2016
@@ -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));
Modified: libcxx/trunk/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp?rev=275732&r1=275731&r2=275732&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp Sun Jul 17 15:32:30 2016
@@ -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>
Modified: libcxx/trunk/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp?rev=275732&r1=275731&r2=275732&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp Sun Jul 17 15:32:30 2016
@@ -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>
More information about the cfe-commits
mailing list