forked from OSchip/llvm-project
Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the utilities library
llvm-svn: 300635
This commit is contained in:
parent
ff6922ad23
commit
95f8e6aa55
|
@ -22,11 +22,11 @@ int main()
|
|||
static_assert(_5::value == 5, "");
|
||||
static_assert((std::is_same<_5::value_type, int>::value), "");
|
||||
static_assert((std::is_same<_5::type, _5>::value), "");
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
static_assert((_5() == 5), "");
|
||||
#else
|
||||
assert(_5() == 5);
|
||||
#endif
|
||||
assert(_5() == 5);
|
||||
|
||||
|
||||
#if TEST_STD_VER > 11
|
||||
static_assert ( _5{}() == 5, "" );
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// type_traits
|
||||
|
||||
// aligned_union<size_t Len, class ...Types>
|
||||
|
@ -17,7 +19,6 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
{
|
||||
typedef std::aligned_union<10, char >::type T1;
|
||||
#if TEST_STD_VER > 11
|
||||
|
@ -90,5 +91,4 @@ int main()
|
|||
static_assert(std::alignment_of<T1>::value == 4, "");
|
||||
static_assert(sizeof(T1) == 4, "");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include <test_macros.h>
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include <test_macros.h>
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class ToDuration, class FromDuration>
|
||||
void
|
||||
test(const FromDuration& f, const ToDuration& d)
|
||||
|
@ -43,7 +45,7 @@ int main()
|
|||
std::chrono::duration<double, std::ratio<3600> >(7265./3600));
|
||||
test(std::chrono::duration<int, std::ratio<2, 3> >(9),
|
||||
std::chrono::duration<int, std::ratio<3, 5> >(10));
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::hours h = std::chrono::duration_cast<std::chrono::hours>(std::chrono::milliseconds(7265000));
|
||||
static_assert(h.count() == 2, "");
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -68,7 +70,7 @@ int main()
|
|||
assert(s1 == s2);
|
||||
assert(!(s1 != s2));
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::seconds s1(3);
|
||||
constexpr std::chrono::seconds s2(3);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -92,7 +94,7 @@ int main()
|
|||
assert( (s1 <= s2));
|
||||
assert( (s1 >= s2));
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::seconds s1(3);
|
||||
constexpr std::chrono::seconds s2(3);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ int main()
|
|||
std::chrono::microseconds us = ms;
|
||||
assert(us.count() == 1000);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::milliseconds ms(1);
|
||||
constexpr std::chrono::microseconds us = ms;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ int main()
|
|||
std::chrono::duration<double, std::milli> ms = us;
|
||||
assert(ms.count() == 1./1000);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::duration<double, std::micro> us(1);
|
||||
constexpr std::chrono::duration<double, std::milli> ms = us;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ int main()
|
|||
std::chrono::duration<double, std::milli> d = i;
|
||||
assert(d.count() == 3000);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::duration<int> i(3);
|
||||
constexpr std::chrono::duration<double, std::milli> d = i;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
template <class D>
|
||||
|
@ -26,7 +27,7 @@ test()
|
|||
{
|
||||
D d;
|
||||
assert(d.count() == typename D::rep());
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
constexpr D d2 = D();
|
||||
static_assert(d2.count() == typename D::rep(), "");
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
template <class D, class R>
|
||||
|
@ -25,7 +26,7 @@ test(R r)
|
|||
{
|
||||
D d(r);
|
||||
assert(d.count() == r);
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
constexpr D d2(R(2));
|
||||
static_assert(d2.count() == 2, "");
|
||||
#endif
|
||||
|
|
|
@ -19,11 +19,13 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
std::chrono::duration<double> d(5);
|
||||
assert(d.count() == 5);
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
constexpr std::chrono::duration<double> d2(5);
|
||||
static_assert(d2.count() == 5, "");
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -44,7 +46,7 @@ int main()
|
|||
std::chrono::duration<double, std::ratio<1, 15> > r = s1 + s2;
|
||||
assert(r.count() == 75);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::seconds s1(3);
|
||||
constexpr std::chrono::seconds s2(5);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -45,7 +47,7 @@ int main()
|
|||
std::chrono::duration<double, std::ratio<1, 15> > r = s1 - s2;
|
||||
assert(r.count() == -15);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::seconds s1(3);
|
||||
constexpr std::chrono::seconds s2(5);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -41,7 +43,7 @@ int main()
|
|||
std::chrono::duration<double, std::ratio<3, 5> > s2(5);
|
||||
assert(s1 / s2 == 20./3);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::nanoseconds ns1(15);
|
||||
constexpr std::chrono::nanoseconds ns2(5);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ int main()
|
|||
ns = ns / 5;
|
||||
assert(ns.count() == 3);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::nanoseconds ns(15);
|
||||
constexpr std::chrono::nanoseconds ns2 = ns / 5;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -39,7 +41,7 @@ int main()
|
|||
std::chrono::duration<int, std::ratio<1, 15> > r = s1 % s2;
|
||||
assert(r.count() == 24);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::nanoseconds ns1(15);
|
||||
constexpr std::chrono::nanoseconds ns2(6);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ int main()
|
|||
ns = ns % 6;
|
||||
assert(ns.count() == 3);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::nanoseconds ns(15);
|
||||
constexpr std::chrono::nanoseconds ns2 = ns % 6;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -33,7 +35,7 @@ int main()
|
|||
ns = 6 * ns;
|
||||
assert(ns.count() == 90);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
constexpr std::chrono::nanoseconds ns(3);
|
||||
constexpr std::chrono::nanoseconds ns2 = ns * 5;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
template <class D>
|
||||
|
@ -27,7 +28,7 @@ void test()
|
|||
Rep max_rep = std::chrono::duration_values<Rep>::max();
|
||||
assert(D::max().count() == max_rep);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef typename D::rep Rep;
|
||||
constexpr Rep max_rep = std::chrono::duration_values<Rep>::max();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
template <class D>
|
||||
|
@ -27,7 +28,7 @@ void test()
|
|||
Rep min_rep = std::chrono::duration_values<Rep>::min();
|
||||
assert(D::min().count() == min_rep);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef typename D::rep Rep;
|
||||
constexpr Rep min_rep = std::chrono::duration_values<Rep>::min();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
template <class D>
|
||||
|
@ -26,7 +27,7 @@ void test()
|
|||
Rep zero_rep = std::chrono::duration_values<Rep>::zero();
|
||||
assert(D::zero().count() == zero_rep);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef typename D::rep Rep;
|
||||
constexpr Rep zero_rep = std::chrono::duration_values<Rep>::zero();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
int main()
|
||||
|
@ -25,7 +26,7 @@ int main()
|
|||
std::numeric_limits<double>::max());
|
||||
assert(std::chrono::duration_values<Rep>::max() ==
|
||||
std::numeric_limits<Rep>::max());
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
static_assert(std::chrono::duration_values<int>::max() ==
|
||||
std::numeric_limits<int>::max(), "");
|
||||
static_assert(std::chrono::duration_values<double>::max() ==
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
int main()
|
||||
|
@ -25,7 +26,7 @@ int main()
|
|||
std::numeric_limits<double>::lowest());
|
||||
assert(std::chrono::duration_values<Rep>::min() ==
|
||||
std::numeric_limits<Rep>::lowest());
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
static_assert(std::chrono::duration_values<int>::min() ==
|
||||
std::numeric_limits<int>::lowest(), "");
|
||||
static_assert(std::chrono::duration_values<double>::min() ==
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "../../rep.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(std::chrono::duration_values<int>::zero() == 0);
|
||||
assert(std::chrono::duration_values<Rep>::zero() == 0);
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#if TEST_STD_VER >= 11
|
||||
static_assert(std::chrono::duration_values<int>::zero() == 0, "");
|
||||
static_assert(std::chrono::duration_values<Rep>::zero() == 0, "");
|
||||
#endif
|
||||
|
|
|
@ -86,7 +86,6 @@ int main()
|
|||
static_assert(!noexcept(std::tuple<NoExceptDefault, ThrowingDefault>()), "");
|
||||
static_assert(!noexcept(std::tuple<ThrowingDefault, ThrowingDefault>()), "");
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
{
|
||||
constexpr std::tuple<> t;
|
||||
}
|
||||
|
@ -106,5 +105,4 @@ int main()
|
|||
IllFormedDefault v(0);
|
||||
std::tuple<IllFormedDefault> t(v);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <utility>
|
||||
|
||||
// template <class T1, class T2> struct pair
|
||||
|
@ -42,7 +44,6 @@ public:
|
|||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
std::pair<A, B> p(std::piecewise_construct,
|
||||
std::make_tuple(4, 'a'),
|
||||
std::make_tuple(3.5, 6u, 2u));
|
||||
|
@ -51,5 +52,4 @@ int main()
|
|||
assert(p.second.get_d() == 3.5);
|
||||
assert(p.second.get_u1() == 6u);
|
||||
assert(p.second.get_u2() == 2u);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <utility>
|
||||
|
||||
// template <class T1, class T2> struct pair
|
||||
|
@ -21,7 +23,6 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
{
|
||||
typedef std::pair<int, int*> P1;
|
||||
typedef std::pair<int*, int> P2;
|
||||
|
@ -31,5 +32,4 @@ int main()
|
|||
assert(p3.first == P1(3, nullptr));
|
||||
assert(p3.second == P2(nullptr, 4));
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue