[libcxx] Improve tests to use the UNSUPPORTED lit directive

Quite a few libcxx tests seem to follow the format:
 #if _LIBCPP_STD_VER > X
   // Do test.
 #else
   // Empty test.
 #endif
We should instead use the UNSUPPORTED lit directive to exclude the test on
earlier C++ standards. This gives us a more accurate number of test passes
for those standards and avoids unnecessary conflicts with other lit
directives on the same tests.

Reviewers: bcraig, ericwf, mclow.lists

Differential revision: http://reviews.llvm.org/D20730

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Asiri Rathnayake
2016-05-28 08:57:35 +00:00
parent dcb35ad8ae
commit a3eac518e6
126 changed files with 176 additions and 581 deletions

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.cons // dynarray.cons
// template <class Alloc> // template <class Alloc>
@@ -23,8 +24,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -81,6 +80,4 @@ int main()
// test ( nstr("fourteen"), Alloc(3), Alloc(4) ); // test ( nstr("fourteen"), Alloc(3), Alloc(4) );
// test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6)); // test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6));
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.data // dynarray.data
// void fill(const T& v); // void fill(const T& v);
@@ -15,8 +16,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -43,6 +42,4 @@ int main()
test<std::complex<double>> ( std::complex<double> ( 14, 0 )); test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" ); test<std::string> ( "fourteen" );
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// dynarray.overview // dynarray.overview
@@ -15,8 +16,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -90,6 +89,4 @@ int main()
test<std::complex<double>> ( {} ); test<std::complex<double>> ( {} );
test<std::string> ( {} ); test<std::string> ( {} );
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.overview // dynarray.overview
@@ -27,8 +28,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -103,6 +102,4 @@ int main()
test<std::complex<double>> ( std::complex<double> ( 14, 0 )); test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" ); test<std::string> ( "fourteen" );
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.overview // dynarray.overview
// size_type size() const noexcept; // size_type size() const noexcept;
@@ -15,8 +16,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -52,6 +51,4 @@ int main()
test<std::complex<double>> ( {} ); test<std::complex<double>> ( {} );
test<std::string> ( {} ); test<std::string> ( {} );
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.overview // dynarray.overview
// const_reference at(size_type n) const; // const_reference at(size_type n) const;
@@ -14,8 +15,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -66,6 +65,4 @@ int main()
test<std::complex<double>> ( {} ); test<std::complex<double>> ( {} );
test<std::string> ( {} ); test<std::string> ( {} );
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.data // dynarray.data
// template <class Type, class Alloc> // template <class Type, class Alloc>
@@ -15,8 +16,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include "test_allocator.h" #include "test_allocator.h"
@@ -26,6 +25,4 @@ int main()
{ {
static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" ); static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" );
} }
#else
int main() {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.zero // dynarray.zero
// dynarray shall provide support for the special case of construction with a size of zero. // dynarray shall provide support for the special case of construction with a size of zero.
@@ -18,8 +19,6 @@
#include <__config> #include <__config>
#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray> #include <experimental/dynarray>
#include <cassert> #include <cassert>
@@ -45,6 +44,4 @@ int main()
test<std::complex<double>> (); test<std::complex<double>> ();
test<std::string> (); test<std::string> ();
} }
#else
int main() {}
#endif

View File

@@ -7,16 +7,15 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/ratio> // <experimental/ratio>
// Test that <ratio> is included. // Test that <ratio> is included.
#include <experimental/ratio> #include <experimental/ratio>
#if _LIBCPP_STD_VER > 11 #ifndef _LIBCPP_RATIO
# ifndef _LIBCPP_RATIO
# error " <experimental/ratio> must include <ratio>" # error " <experimental/ratio> must include <ratio>"
# endif
#endif #endif
int main() int main()

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/system_error> // <experimental/system_error>
#include <experimental/system_error> #include <experimental/system_error>
#if _LIBCPP_STD_VER > 11 #ifndef _LIBCPP_SYSTEM_ERROR
# ifndef _LIBCPP_SYSTEM_ERROR
# error "<experimental/system_error> must include <system_error>" # error "<experimental/system_error> must include <system_error>"
# endif
#endif #endif
int main() int main()

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/chrono> // <experimental/chrono>
#include <experimental/chrono> #include <experimental/chrono>
#if _LIBCPP_STD_VER > 11 #ifndef _LIBCPP_CHRONO
# ifndef _LIBCPP_CHRONO
# error "<experimental/chrono> must include <chrono>" # error "<experimental/chrono> must include <chrono>"
# endif
#endif #endif
int main() int main()

View File

@@ -7,15 +7,14 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/tuple> // <experimental/tuple>
#include <experimental/tuple> #include <experimental/tuple>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11 #ifndef _LIBCPP_TUPLE
# ifndef _LIBCPP_TUPLE
# error "<experimental/tuple> must include <tuple>" # error "<experimental/tuple> must include <tuple>"
# endif #endif
#endif /* _LIBCPP_STD_VER > 11 */
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <list> // <list>
// Operations on "NULL" iterators // Operations on "NULL" iterators
@@ -25,7 +26,6 @@ struct S { int val; };
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
unsigned lib_asserts; unsigned lib_asserts;
@@ -55,7 +55,6 @@ int main()
try { (void) ci->val; } catch (int) { ++lib_asserts; } try { (void) ci->val; } catch (int) { ++lib_asserts; }
assert(lib_asserts == 4); assert(lib_asserts == 4);
} }
#endif
} }
#else #else

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <vector> // <vector>
// vector<bool> // vector<bool>
@@ -18,7 +19,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef std::vector<bool> C; typedef std::vector<bool> C;
C c; C c;
@@ -64,5 +64,4 @@ int main()
assert(c[1] == true); assert(c[1] == true);
assert(c.back() == true); assert(c.back() == true);
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <vector> // <vector>
// vector.bool // vector.bool
@@ -19,7 +20,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef std::vector<bool> C; typedef std::vector<bool> C;
C c; C c;
@@ -53,5 +53,4 @@ int main()
assert(c[1] == true); assert(c[1] == true);
assert(c.back() == true); assert(c.back() == true);
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <system_error> // <system_error>
// class error_category // class error_category
@@ -18,8 +19,6 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
class test1 class test1
: public std::error_category : public std::error_category
{ {
@@ -29,12 +28,8 @@ public:
virtual std::string message(int) const {return std::string();} virtual std::string message(int) const {return std::string();}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
static_assert(std::is_nothrow_default_constructible<test1>::value, static_assert(std::is_nothrow_default_constructible<test1>::value,
"error_category() must exist and be noexcept"); "error_category() must exist and be noexcept");
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// class bad_optional_access is default constructible // class bad_optional_access is default constructible
@@ -16,8 +18,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::bad_optional_access; using std::experimental::bad_optional_access;
bad_optional_access ex; bad_optional_access ex;
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// class bad_optional_access : public logic_error // class bad_optional_access : public logic_error
@@ -16,10 +18,8 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::bad_optional_access; using std::experimental::bad_optional_access;
static_assert(std::is_base_of<std::logic_error, bad_optional_access>::value, ""); static_assert(std::is_base_of<std::logic_error, bad_optional_access>::value, "");
static_assert(std::is_convertible<bad_optional_access*, std::logic_error*>::value, ""); static_assert(std::is_convertible<bad_optional_access*, std::logic_error*>::value, "");
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator==(const optional<T>& x, const T& v); // template <class T> constexpr bool operator==(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,11 +27,8 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs ) constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; } { return lhs.i_ == rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -54,5 +50,4 @@ int main()
static_assert ( (T(2) == o3), "" ); static_assert ( (T(2) == o3), "" );
static_assert ( (val == o3), "" ); static_assert ( (val == o3), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator>(const optional<T>& x, const T& v); // template <class T> constexpr bool operator>(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,12 +27,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( !(val > o3), "" ); // equal static_assert ( !(val > o3), "" ); // equal
static_assert ( (T(3) > o3), "" ); static_assert ( (T(3) > o3), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator>=(const optional<T>& x, const T& v); // template <class T> constexpr bool operator>=(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,12 +27,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( (val >= o3), "" ); // equal static_assert ( (val >= o3), "" ); // equal
static_assert ( (T(3) >= o3), "" ); static_assert ( (T(3) >= o3), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator<=(const optional<T>& x, const T& v); // template <class T> constexpr bool operator<=(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,12 +27,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( (val <= o3), "" ); // equal static_assert ( (val <= o3), "" ); // equal
static_assert ( !(T(3) <= o3), "" ); static_assert ( !(T(3) <= o3), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator<(const optional<T>& x, const T& v); // template <class T> constexpr bool operator<(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,12 +27,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -57,5 +52,4 @@ int main()
static_assert ( !(val < o3), "" ); // equal static_assert ( !(val < o3), "" ); // equal
static_assert ( !(T(3) < o3), "" ); static_assert ( !(T(3) < o3), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator!=(const optional<T>& x, const T& v); // template <class T> constexpr bool operator!=(const optional<T>& x, const T& v);
@@ -14,8 +15,6 @@
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,11 +27,8 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs ) constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; } { return lhs.i_ == rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -54,5 +50,4 @@ int main()
static_assert ( !(T(2) != o3), "" ); static_assert ( !(T(2) != o3), "" );
static_assert ( !(val != o3), "" ); static_assert ( !(val != o3), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> struct hash<optional<T>>; // template <class T> struct hash<optional<T>>;
@@ -19,7 +20,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
{ {
@@ -43,5 +43,4 @@ int main()
opt = std::unique_ptr<int>(new int(3)); opt = std::unique_ptr<int>(new int(3));
assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// struct in_place_t{}; // struct in_place_t{};
@@ -15,8 +16,6 @@
#include <experimental/optional> #include <experimental/optional>
#include <type_traits> #include <type_traits>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::in_place_t; using std::experimental::in_place_t;
using std::experimental::in_place; using std::experimental::in_place;
@@ -28,15 +27,10 @@ test(const in_place_t&)
return 3; return 3;
} }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
static_assert((std::is_class<in_place_t>::value), ""); static_assert((std::is_class<in_place_t>::value), "");
static_assert((std::is_empty<in_place_t>::value), ""); static_assert((std::is_empty<in_place_t>::value), "");
static_assert(test(in_place) == 3, ""); static_assert(test(in_place) == 3, "");
#endif
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept; // template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt == o1), ""); static_assert (noexcept(nullopt == o1), "");
static_assert (noexcept(o1 == nullopt), ""); static_assert (noexcept(o1 == nullopt), "");
} }
#endif
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept; // template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt > o1), ""); static_assert (noexcept(nullopt > o1), "");
static_assert (noexcept(o1 > nullopt), ""); static_assert (noexcept(o1 > nullopt), "");
} }
#endif
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator>=(const optional<T>& x, nullopt_t) noexcept; // template <class T> constexpr bool operator>=(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt >= o1), ""); static_assert (noexcept(nullopt >= o1), "");
static_assert (noexcept(o1 >= nullopt), ""); static_assert (noexcept(o1 >= nullopt), "");
} }
#endif
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept; // template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt < o1), ""); static_assert (noexcept(nullopt < o1), "");
static_assert (noexcept(o1 < nullopt), ""); static_assert (noexcept(o1 < nullopt), "");
} }
#endif
} }

View File

@@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept; // template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept;
@@ -17,7 +17,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -37,5 +36,4 @@ int main()
static_assert (noexcept(nullopt != o1), ""); static_assert (noexcept(nullopt != o1), "");
static_assert (noexcept(o1 != nullopt), ""); static_assert (noexcept(o1 != nullopt), "");
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// struct nullopt_t{see below}; // struct nullopt_t{see below};
@@ -15,8 +16,6 @@
#include <experimental/optional> #include <experimental/optional>
#include <type_traits> #include <type_traits>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -28,16 +27,12 @@ test(const nullopt_t&)
return 3; return 3;
} }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
static_assert((std::is_class<nullopt_t>::value), ""); static_assert((std::is_class<nullopt_t>::value), "");
static_assert((std::is_empty<nullopt_t>::value), ""); static_assert((std::is_empty<nullopt_t>::value), "");
static_assert((std::is_literal_type<nullopt_t>::value), ""); static_assert((std::is_literal_type<nullopt_t>::value), "");
static_assert((!std::is_default_constructible<nullopt_t>::value), ""); static_assert((!std::is_default_constructible<nullopt_t>::value), "");
static_assert(test(nullopt) == 3, ""); static_assert(test(nullopt) == 3, "");
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class U> optional<T>& operator=(U&& v); // template <class U> optional<T>& operator=(U&& v);
@@ -16,19 +17,14 @@
#include <cassert> #include <cassert>
#include <memory> #include <memory>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
{ {
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
static_assert(std::is_assignable<optional<int>, int>::value, ""); static_assert(std::is_assignable<optional<int>, int>::value, "");
static_assert(std::is_assignable<optional<int>, int&>::value, ""); static_assert(std::is_assignable<optional<int>, int&>::value, "");
static_assert(std::is_assignable<optional<int>&, int>::value, ""); static_assert(std::is_assignable<optional<int>&, int>::value, "");
@@ -68,5 +64,4 @@ int main()
assert(static_cast<bool>(opt) == true); assert(static_cast<bool>(opt) == true);
assert(**opt == 3); assert(**opt == 3);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -16,8 +17,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -34,11 +33,8 @@ struct X
bool X::throw_now = false; bool X::throw_now = false;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<int> opt; optional<int> opt;
constexpr optional<int> opt2; constexpr optional<int> opt2;
@@ -87,5 +83,4 @@ int main()
assert(static_cast<bool>(opt) == false); assert(static_cast<bool>(opt) == false);
} }
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -17,8 +18,6 @@
#include <cassert> #include <cassert>
#include <memory> #include <memory>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
class X class X
@@ -55,11 +54,8 @@ public:
bool Z::dtor_called = false; bool Z::dtor_called = false;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<int> opt; optional<int> opt;
opt.emplace(); opt.emplace();
@@ -145,5 +141,4 @@ int main()
assert(Z::dtor_called == true); assert(Z::dtor_called == true);
} }
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -18,8 +19,6 @@
#include <cassert> #include <cassert>
#include <vector> #include <vector>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
class X class X
@@ -70,11 +69,8 @@ public:
bool Z::dtor_called = false; bool Z::dtor_called = false;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
X x; X x;
{ {
@@ -113,5 +109,4 @@ int main()
assert(Z::dtor_called == true); assert(Z::dtor_called == true);
} }
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -18,8 +19,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -42,11 +41,8 @@ struct Y {};
bool X::throw_now = false; bool X::throw_now = false;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
static_assert(std::is_nothrow_move_assignable<optional<int>>::value, ""); static_assert(std::is_nothrow_move_assignable<optional<int>>::value, "");
optional<int> opt; optional<int> opt;
@@ -100,5 +96,4 @@ int main()
{ {
static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, ""); static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, "");
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// optional<T>& operator=(nullopt_t) noexcept; // optional<T>& operator=(nullopt_t) noexcept;
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -29,11 +28,8 @@ struct X
bool X::dtor_called = false; bool X::dtor_called = false;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<int> opt; optional<int> opt;
static_assert(noexcept(opt = nullopt) == true, ""); static_assert(noexcept(opt = nullopt) == true, "");
@@ -63,5 +59,4 @@ int main()
assert(static_cast<bool>(opt) == false); assert(static_cast<bool>(opt) == false);
} }
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -16,8 +17,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
template <class T> template <class T>
@@ -76,11 +75,8 @@ public:
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef int T; typedef int T;
optional<T> rhs; optional<T> rhs;
@@ -121,5 +117,4 @@ int main()
optional<T> rhs(Z(3)); optional<T> rhs(Z(3));
test(rhs, true); test(rhs, true);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr optional() noexcept; // constexpr optional() noexcept;
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
template <class Opt> template <class Opt>
@@ -55,13 +54,9 @@ struct X
X(); X();
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
test_constexpr<optional<int>>(); test_constexpr<optional<int>>();
test_constexpr<optional<int*>>(); test_constexpr<optional<int*>>();
test<optional<X>>(); test<optional<X>>();
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -19,8 +20,6 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::in_place_t; using std::experimental::in_place_t;
using std::experimental::in_place; using std::experimental::in_place;
@@ -67,12 +66,8 @@ public:
{return x.i_ == y.i_ && x.j_ == y.j_;} {return x.i_ == y.i_ && x.j_ == y.j_;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
static_assert(!std::is_constructible<X, std::initializer_list<int>&>::value, ""); static_assert(!std::is_constructible<X, std::initializer_list<int>&>::value, "");
static_assert(!std::is_constructible<optional<X>, std::initializer_list<int>&>::value, ""); static_assert(!std::is_constructible<optional<X>, std::initializer_list<int>&>::value, "");
@@ -123,5 +118,4 @@ int main()
}; };
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -16,8 +17,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
template <class T> template <class T>
@@ -75,12 +74,8 @@ public:
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef int T; typedef int T;
optional<T> rhs; optional<T> rhs;
@@ -121,5 +116,4 @@ int main()
optional<T> rhs(Z(3)); optional<T> rhs(Z(3));
test(rhs, true); test(rhs, true);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr optional(nullopt_t) noexcept; // constexpr optional(nullopt_t) noexcept;
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
@@ -56,13 +55,9 @@ struct X
X(); X();
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
test_constexpr<optional<int>>(); test_constexpr<optional<int>>();
test_constexpr<optional<int*>>(); test_constexpr<optional<int*>>();
test<optional<X>>(); test<optional<X>>();
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// ~optional(); // ~optional();
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
class X class X
@@ -29,11 +28,8 @@ public:
bool X::dtor_called = false; bool X::dtor_called = false;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef int T; typedef int T;
static_assert(std::is_trivially_destructible<T>::value, ""); static_assert(std::is_trivially_destructible<T>::value, "");
@@ -55,5 +51,4 @@ int main()
} }
assert(X::dtor_called == true); assert(X::dtor_called == true);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr explicit optional<T>::operator bool() const noexcept; // constexpr explicit optional<T>::operator bool() const noexcept;
@@ -17,7 +18,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
{ {
@@ -28,5 +28,4 @@ int main()
constexpr optional<int> opt(0); constexpr optional<int> opt(0);
static_assert(opt, ""); static_assert(opt, "");
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// T& optional<T>::operator*(); // T& optional<T>::operator*();
@@ -19,8 +20,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -29,11 +28,8 @@ struct X
int test() {return 4;} int test() {return 4;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<X> opt(X{}); optional<X> opt(X{});
assert((*opt).test() == 4); assert((*opt).test() == 4);
@@ -45,5 +41,4 @@ int main()
assert(false); assert(false);
} }
#endif // _LIBCPP_DEBUG #endif // _LIBCPP_DEBUG
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr const T& optional<T>::operator*() const; // constexpr const T& optional<T>::operator*() const;
@@ -19,8 +20,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -33,11 +32,8 @@ struct Y
int test() const {return 2;} int test() const {return 2;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
constexpr optional<X> opt(X{}); constexpr optional<X> opt(X{});
static_assert((*opt).test() == 3, ""); static_assert((*opt).test() == 3, "");
@@ -53,5 +49,4 @@ int main()
assert(false); assert(false);
} }
#endif // _LIBCPP_DEBUG #endif // _LIBCPP_DEBUG
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr T* optional<T>::operator->(); // constexpr T* optional<T>::operator->();
@@ -19,8 +20,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -28,11 +27,8 @@ struct X
constexpr int test() const {return 3;} constexpr int test() const {return 3;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
constexpr optional<X> opt(X{}); constexpr optional<X> opt(X{});
static_assert(opt->test() == 3, ""); static_assert(opt->test() == 3, "");
@@ -44,5 +40,4 @@ int main()
assert(false); assert(false);
} }
#endif // _LIBCPP_DEBUG #endif // _LIBCPP_DEBUG
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr const T* optional<T>::operator->() const; // constexpr const T* optional<T>::operator->() const;
@@ -19,8 +20,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -39,11 +38,8 @@ struct Z
constexpr int test() const {return 1;} constexpr int test() const {return 1;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
constexpr optional<X> opt(X{}); constexpr optional<X> opt(X{});
static_assert(opt->test() == 3, ""); static_assert(opt->test() == 3, "");
@@ -63,5 +59,4 @@ int main()
assert(false); assert(false);
} }
#endif // _LIBCPP_DEBUG #endif // _LIBCPP_DEBUG
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -16,8 +17,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::bad_optional_access; using std::experimental::bad_optional_access;
@@ -29,11 +28,8 @@ struct X
int test() {return 4;} int test() {return 4;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<X> opt; optional<X> opt;
opt.emplace(); opt.emplace();
@@ -50,5 +46,4 @@ int main()
{ {
} }
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// constexpr const T& optional<T>::value() const; // constexpr const T& optional<T>::value() const;
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -25,16 +24,10 @@ struct X
int test() {return 4;} int test() {return 4;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
constexpr optional<X> opt; constexpr optional<X> opt;
static_assert(opt.value().test() == 3, ""); static_assert(opt.value().test() == 3, "");
} }
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -16,8 +17,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::in_place_t; using std::experimental::in_place_t;
using std::experimental::in_place; using std::experimental::in_place;
@@ -31,11 +30,8 @@ struct X
int test() {return 4;} int test() {return 4;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
constexpr optional<X> opt(in_place); constexpr optional<X> opt(in_place);
static_assert(opt.value().test() == 3, ""); static_assert(opt.value().test() == 3, "");
@@ -55,5 +51,4 @@ int main()
{ {
} }
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class U> T optional<T>::value_or(U&& v) &&; // template <class U> T optional<T>::value_or(U&& v) &&;
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::in_place_t; using std::experimental::in_place_t;
using std::experimental::in_place; using std::experimental::in_place;
@@ -40,11 +39,8 @@ struct X
{return x.i_ == y.i_;} {return x.i_ == y.i_;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<X> opt(in_place, 2); optional<X> opt(in_place, 2);
Y y(3); Y y(3);
@@ -67,5 +63,4 @@ int main()
assert(std::move(opt).value_or(Y(3)) == 4); assert(std::move(opt).value_or(Y(3)) == 4);
assert(!opt); assert(!opt);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class U> constexpr T optional<T>::value_or(U&& v) const&; // template <class U> constexpr T optional<T>::value_or(U&& v) const&;
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct Y struct Y
@@ -37,11 +36,8 @@ struct X
{return x.i_ == y.i_;} {return x.i_ == y.i_;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
constexpr optional<X> opt(2); constexpr optional<X> opt(2);
constexpr Y y(3); constexpr Y y(3);
@@ -78,5 +74,4 @@ int main()
const optional<X> opt; const optional<X> opt;
assert(opt.value_or(Y(3)) == 4); assert(opt.value_or(Y(3)) == 4);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -18,8 +19,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
class X class X
@@ -63,12 +62,8 @@ public:
friend void swap(Z& x, Z& y) {throw 6;} friend void swap(Z& x, Z& y) {throw 6;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<int> opt1; optional<int> opt1;
optional<int> opt2; optional<int> opt2;
@@ -303,5 +298,4 @@ int main()
assert(static_cast<bool>(opt2) == true); assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2); assert(*opt2 == 2);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// T shall be an object type and shall satisfy the requirements of Destructible // T shall be an object type and shall satisfy the requirements of Destructible
@@ -15,11 +16,7 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
optional<const void> opt; optional<const void> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// T shall be an object type and shall satisfy the requirements of Destructible // T shall be an object type and shall satisfy the requirements of Destructible
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -23,13 +22,7 @@ private:
~X() {} ~X() {}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
optional<X> opt; optional<X> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// T shall be an object type and shall satisfy the requirements of Destructible // T shall be an object type and shall satisfy the requirements of Destructible
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -22,13 +21,7 @@ struct X
~X() noexcept(false) {} ~X() noexcept(false) {}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
optional<X> opt; optional<X> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// T shall be an object type and shall satisfy the requirements of Destructible // T shall be an object type and shall satisfy the requirements of Destructible
@@ -15,11 +16,7 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
optional<void> opt; optional<void> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> // template <class T>
@@ -19,8 +20,6 @@
#include <experimental/optional> #include <experimental/optional>
#include <type_traits> #include <type_traits>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
template <class Opt, class T> template <class Opt, class T>
@@ -30,14 +29,10 @@ test()
static_assert(std::is_same<typename Opt::value_type, T>::value, ""); static_assert(std::is_same<typename Opt::value_type, T>::value, "");
} }
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
test<optional<int>, int>(); test<optional<int>, int>();
test<optional<const int>, const int>(); test<optional<const int>, const int>();
test<optional<double>, double>(); test<optional<double>, double>();
test<optional<const double>, const double>(); test<optional<const double>, const double>();
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y); // template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y);
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -29,11 +28,8 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs ) constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; } { return lhs.i_ == rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -75,5 +71,4 @@ int main()
static_assert ( o5 == o5 , "" ); static_assert ( o5 == o5 , "" );
} }
#endif
} }

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator>= (const optional<T>& x, const optional<T>& y); // template <class T> constexpr bool operator>= (const optional<T>& x, const optional<T>& y);
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -27,11 +26,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef optional<X> O; typedef optional<X> O;
@@ -71,5 +67,4 @@ int main()
static_assert ( !(o5 >= o4), "" ); static_assert ( !(o5 >= o4), "" );
static_assert ( (o5 >= o5), "" ); static_assert ( (o5 >= o5), "" );
} }
#endif
} }

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator> (const optional<T>& x, const optional<T>& y); // template <class T> constexpr bool operator> (const optional<T>& x, const optional<T>& y);
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -27,11 +26,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef optional<X> O; typedef optional<X> O;
@@ -71,5 +67,4 @@ int main()
static_assert ( !(o5 > o4), "" ); static_assert ( !(o5 > o4), "" );
static_assert ( !(o5 > o5), "" ); static_assert ( !(o5 > o5), "" );
} }
#endif
} }

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator<= (const optional<T>& x, const optional<T>& y); // template <class T> constexpr bool operator<= (const optional<T>& x, const optional<T>& y);
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -27,11 +26,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef optional<X> O; typedef optional<X> O;
@@ -71,5 +67,4 @@ int main()
static_assert ( (o5 <= o4), "" ); static_assert ( (o5 <= o4), "" );
static_assert ( (o5 <= o5), "" ); static_assert ( (o5 <= o5), "" );
} }
#endif
} }

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator< (const optional<T>& x, const optional<T>& y); // template <class T> constexpr bool operator< (const optional<T>& x, const optional<T>& y);
#include <experimental/optional> #include <experimental/optional>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -27,11 +26,8 @@ struct X
constexpr bool operator < ( const X &lhs, const X &rhs ) constexpr bool operator < ( const X &lhs, const X &rhs )
{ return lhs.i_ < rhs.i_ ; } { return lhs.i_ < rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef optional<X> O; typedef optional<X> O;
@@ -71,5 +67,4 @@ int main()
static_assert ( (o5 < o4), "" ); static_assert ( (o5 < o4), "" );
static_assert ( !(o5 < o5), "" ); static_assert ( !(o5 < o5), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y); // template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y);
@@ -15,8 +16,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
struct X struct X
@@ -29,11 +28,8 @@ struct X
constexpr bool operator == ( const X &lhs, const X &rhs ) constexpr bool operator == ( const X &lhs, const X &rhs )
{ return lhs.i_ == rhs.i_ ; } { return lhs.i_ == rhs.i_ ; }
#endif
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
typedef X T; typedef X T;
typedef optional<T> O; typedef optional<T> O;
@@ -75,5 +71,4 @@ int main()
static_assert ( !(o5 != o5), "" ); static_assert ( !(o5 != o5), "" );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// template <class T> // template <class T>
@@ -21,7 +22,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::make_optional; using std::experimental::make_optional;
@@ -46,5 +46,4 @@ int main()
assert(**opt == 3); assert(**opt == 3);
assert(s == nullptr); assert(s == nullptr);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// XFAIL: libcpp-no-exceptions // XFAIL: libcpp-no-exceptions
// <optional> // <optional>
@@ -17,8 +18,6 @@
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
class X class X
@@ -62,12 +61,8 @@ public:
friend void swap(Z& x, Z& y) {throw 6;} friend void swap(Z& x, Z& y) {throw 6;}
}; };
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ {
optional<int> opt1; optional<int> opt1;
optional<int> opt2; optional<int> opt2;
@@ -302,5 +297,4 @@ int main()
assert(static_cast<bool>(opt2) == true); assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2); assert(*opt2 == 2);
} }
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for // A program that necessitates the instantiation of template optional for
@@ -16,13 +17,9 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::in_place_t; using std::experimental::in_place_t;
using std::experimental::in_place; using std::experimental::in_place;
optional<const in_place_t> opt; optional<const in_place_t> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for a // A program that necessitates the instantiation of template optional for a
@@ -16,11 +17,7 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
optional<const int&> opt; optional<const int&> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for // A program that necessitates the instantiation of template optional for
@@ -16,13 +17,9 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
optional<const nullopt_t> opt; optional<const nullopt_t> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for // A program that necessitates the instantiation of template optional for
@@ -16,13 +17,9 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::in_place_t; using std::experimental::in_place_t;
using std::experimental::in_place; using std::experimental::in_place;
optional<in_place_t> opt; optional<in_place_t> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// #include <initializer_list> // #include <initializer_list>
@@ -15,9 +16,7 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
std::initializer_list<int> list; std::initializer_list<int> list;
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for a // A program that necessitates the instantiation of template optional for a
@@ -16,11 +17,7 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
optional<int&> opt; optional<int&> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for // A program that necessitates the instantiation of template optional for
@@ -16,13 +17,9 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
using std::experimental::nullopt_t; using std::experimental::nullopt_t;
using std::experimental::nullopt; using std::experimental::nullopt;
optional<nullopt_t> opt; optional<nullopt_t> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <optional> // <optional>
// A program that necessitates the instantiation of template optional for a // A program that necessitates the instantiation of template optional for a
@@ -16,11 +17,7 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::experimental::optional; using std::experimental::optional;
optional<int&&> opt; optional<int&&> opt;
#else
#error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <string> // <string>
// template<class charT, class traits, class Allocator> // template<class charT, class traits, class Allocator>
@@ -17,8 +18,6 @@
#include <experimental/string_view> #include <experimental/string_view>
#include <cassert> #include <cassert>
#if _LIBCPP_STD_VER > 11
template <class S> template <class S>
void void
test(const std::string &lhs, S rhs, bool x) test(const std::string &lhs, S rhs, bool x)
@@ -49,6 +48,4 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
} }
} }
#else
int main () {}
#endif

View File

@@ -7,14 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits> // <experimental/type_traits>
#include <experimental/type_traits> #include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11 #ifndef _LIBCPP_TYPE_TRAITS
# ifndef _LIBCPP_TYPE_TRAITS
# error "<experimental/type_traits> must include <type_traits>" # error "<experimental/type_traits> must include <type_traits>"
# endif
#endif #endif
int main() int main()

View File

@@ -7,12 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits> // <experimental/type_traits>
#include <experimental/type_traits> #include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11
namespace ex = std::experimental; namespace ex = std::experimental;
struct base_type {}; struct base_type {};
@@ -60,6 +59,4 @@ int main()
static_assert(ex::is_convertible_v<T, U> == std::is_convertible<T, U>::value, ""); static_assert(ex::is_convertible_v<T, U> == std::is_convertible<T, U>::value, "");
} }
} }
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */

View File

@@ -7,12 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits> // <experimental/type_traits>
#include <experimental/type_traits> #include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11
namespace ex = std::experimental; namespace ex = std::experimental;
struct class_type {}; struct class_type {};
@@ -176,6 +175,4 @@ int main()
static_assert(ex::is_function_v<T> == std::is_function<T>::value, ""); static_assert(ex::is_function_v<T> == std::is_function<T>::value, "");
} }
} }
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */

View File

@@ -7,12 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits> // <experimental/type_traits>
#include <experimental/type_traits> #include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11
namespace ex = std::experimental; namespace ex = std::experimental;
struct class_type {}; struct class_type {};
@@ -97,6 +96,4 @@ int main()
static_assert(ex::is_member_pointer_v<T> == std::is_member_pointer<T>::value, ""); static_assert(ex::is_member_pointer_v<T> == std::is_member_pointer<T>::value, "");
} }
} }
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */

View File

@@ -7,12 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits> // <experimental/type_traits>
#include <experimental/type_traits> #include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11
namespace ex = std::experimental; namespace ex = std::experimental;
struct non_literal_type { non_literal_type() {} }; struct non_literal_type { non_literal_type() {} };
@@ -484,6 +483,4 @@ int main()
static_assert(ex::has_virtual_destructor_v<T> == std::has_virtual_destructor<T>::value, ""); static_assert(ex::has_virtual_destructor_v<T> == std::has_virtual_destructor<T>::value, "");
} }
} }
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */

View File

@@ -7,12 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/type_traits> // <experimental/type_traits>
#include <experimental/type_traits> #include <experimental/type_traits>
#if _LIBCPP_STD_VER > 11
namespace ex = std::experimental; namespace ex = std::experimental;
int main() int main()
@@ -61,6 +60,3 @@ int main()
static_assert(ex::extent_v<T, 0> == std::extent<T, 0>::value, ""); static_assert(ex::extent_v<T, 0> == std::extent<T, 0>::value, "");
} }
} }
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// test <cstdio> // test <cstdio>
// gets // gets
@@ -15,9 +16,5 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
(void) std::gets((char *) NULL); (void) std::gets((char *) NULL);
#else
#error
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <iterator> // <iterator>
// reverse_iterator // reverse_iterator
@@ -19,8 +20,6 @@
#include "test_iterators.h" #include "test_iterators.h"
#if _LIBCPP_STD_VER > 11
template <class It> template <class It>
void void
test(It i) test(It i)
@@ -37,6 +36,4 @@ int main()
while ( b != e ) while ( b != e )
test ( b++ ); test ( b++ );
} }
#else
int main () {}
#endif

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// test bad_array_length // test bad_array_length
#include <new> #include <new>
@@ -15,7 +16,6 @@
int main() int main()
{ {
#if __LIBCPP_STD_VER > 11
static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value), static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
"std::is_base_of<std::bad_alloc, std::bad_array_length>::value"); "std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
static_assert(std::is_polymorphic<std::bad_array_length>::value, static_assert(std::is_polymorphic<std::bad_array_length>::value,
@@ -25,5 +25,4 @@ int main()
b2 = b; b2 = b;
const char* w = b2.what(); const char* w = b2.what();
assert(w); assert(w);
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <chrono> // <chrono>
#include <complex> #include <complex>
@@ -15,7 +16,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std::literals::complex_literals; using namespace std::literals::complex_literals;
// Make sure the types are right // Make sure the types are right
@@ -46,6 +46,4 @@ int main()
auto c2 = 3if; auto c2 = 3if;
assert ( c1 == c2 ); assert ( c1 == c2 );
} }
#endif
} }

View File

@@ -7,14 +7,12 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <complex> #include <complex>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
std::complex<float> foo = 1.0if; // should fail w/conversion operator not found std::complex<float> foo = 1.0if; // should fail w/conversion operator not found
#else
#error
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <chrono> // <chrono>
#include <complex> #include <complex>
@@ -15,7 +16,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std::literals; using namespace std::literals;
{ {
@@ -38,6 +38,4 @@ int main()
auto c2 = 3if; auto c2 = 3if;
assert ( c1 == c2 ); assert ( c1 == c2 );
} }
#endif
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <chrono> // <chrono>
#include <complex> #include <complex>
@@ -15,7 +16,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std; using namespace std;
{ {
@@ -38,6 +38,4 @@ int main()
auto c2 = 3if; auto c2 = 3if;
assert ( c1 == c2 ); assert ( c1 == c2 );
} }
#endif
} }

View File

@@ -7,12 +7,14 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <string> #include <string>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
static_assert ( std::is_same<decltype( "Hi"s), std::string>::value, "" ); static_assert ( std::is_same<decltype( "Hi"s), std::string>::value, "" );
@@ -43,5 +45,4 @@ int main()
Lfoo = L"ABC"s; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring ( L"ABC")); Lfoo = L"ABC"s; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring ( L"ABC"));
ufoo = u"ABC"s; assert(ufoo == u"ABC"); assert(ufoo == std::u16string( u"ABC")); ufoo = u"ABC"s; assert(ufoo == u"ABC"); assert(ufoo == std::u16string( u"ABC"));
Ufoo = U"ABC"s; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string( U"ABC")); Ufoo = U"ABC"s; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string( U"ABC"));
#endif
} }

View File

@@ -7,16 +7,15 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <string> #include <string>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using std::string; using std::string;
string foo = ""s; // should fail w/conversion operator not found string foo = ""s; // should fail w/conversion operator not found
#else
#error
#endif
} }

View File

@@ -7,14 +7,15 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <string> #include <string>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std::literals; using namespace std::literals;
std::string foo = ""s; std::string foo = ""s;
#endif
} }

View File

@@ -7,14 +7,13 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <string> #include <string>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
std::string foo = ""s; // should fail w/conversion operator not found std::string foo = ""s; // should fail w/conversion operator not found
#else
#error
#endif
} }

View File

@@ -7,14 +7,15 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <string> #include <string>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
std::string foo = ""s; std::string foo = ""s;
#endif
} }

View File

@@ -7,14 +7,15 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
#include <string> #include <string>
#include <cassert> #include <cassert>
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
using namespace std; using namespace std;
string foo = ""s; string foo = ""s;
#endif
} }

View File

@@ -7,6 +7,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <string> // <string>
// iterator begin(); // iterator begin();
@@ -21,7 +23,6 @@
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
{ // N3644 testing { // N3644 testing
typedef std::string C; typedef std::string C;
C::iterator ii1{}, ii2{}; C::iterator ii1{}, ii2{};
@@ -69,5 +70,4 @@ int main()
assert ( !(ii1 != ii2 )); assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii )); assert ( !(ii1 != cii ));
} }
#endif
} }

View File

@@ -7,8 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// XFAIL: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads, libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <future> // <future>

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex> // <shared_mutex>
// template <class Mutex> class shared_lock; // template <class Mutex> class shared_lock;
@@ -15,20 +16,12 @@
#include <shared_mutex> #include <shared_mutex>
#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m0; std::shared_timed_mutex m0;
std::shared_timed_mutex m1; std::shared_timed_mutex m1;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0(m0); std::shared_lock<std::shared_timed_mutex> lk0(m0);
std::shared_lock<std::shared_timed_mutex> lk1(m1); std::shared_lock<std::shared_timed_mutex> lk1(m1);
lk1 = lk0; lk1 = lk0;
#else
# error
#endif // _LIBCPP_STD_VER > 11
} }

View File

@@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex> // <shared_mutex>
// template <class Mutex> class shared_lock; // template <class Mutex> class shared_lock;
@@ -15,16 +16,10 @@
#include <shared_mutex> #include <shared_mutex>
#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m; std::shared_timed_mutex m;
#endif // _LIBCPP_STD_VER > 11
int main() int main()
{ {
#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0(m); std::shared_lock<std::shared_timed_mutex> lk0(m);
std::shared_lock<std::shared_timed_mutex> lk = lk0; std::shared_lock<std::shared_timed_mutex> lk = lk0;
#else
# error
#endif // _LIBCPP_STD_VER > 11
} }

Some files were not shown because too many files have changed in this diff Show More