diff options
Diffstat (limited to 'libcxx/test/utilities/meta')
83 files changed, 4035 insertions, 83 deletions
diff --git a/libcxx/test/utilities/meta/meta.hel/integral_constant.pass.cpp b/libcxx/test/utilities/meta/meta.hel/integral_constant.pass.cpp index f963769d9c0..47b8eaf18b2 100644 --- a/libcxx/test/utilities/meta/meta.hel/integral_constant.pass.cpp +++ b/libcxx/test/utilities/meta/meta.hel/integral_constant.pass.cpp @@ -1 +1,36 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// integral_constant
#include <type_traits>
int main()
{
typedef std::integral_constant<int, 5> _5;
static_assert(_5::value == 5, "");
static_assert((std::is_same<_5::value_type, int>::value), "");
static_assert((std::is_same<_5::type, _5>::value), "");
static_assert(std::false_type::value == false, "");
static_assert((std::is_same<std::false_type::value_type, bool>::value), "");
static_assert((std::is_same<std::false_type::type, std::false_type>::value), "");
static_assert(std::true_type::value == true, "");
static_assert((std::is_same<std::true_type::value_type, bool>::value), "");
static_assert((std::is_same<std::true_type::type, std::true_type>::value), "");
std::false_type f1;
std::false_type f2 = f1;
std::true_type t1;
std::true_type t2 = t1;
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// integral_constant + +#include <type_traits> + +int main() +{ + typedef std::integral_constant<int, 5> _5; + static_assert(_5::value == 5, ""); + static_assert((std::is_same<_5::value_type, int>::value), ""); + static_assert((std::is_same<_5::type, _5>::value), ""); + + static_assert(std::false_type::value == false, ""); + static_assert((std::is_same<std::false_type::value_type, bool>::value), ""); + static_assert((std::is_same<std::false_type::type, std::false_type>::value), ""); + + static_assert(std::true_type::value == true, ""); + static_assert((std::is_same<std::true_type::value_type, bool>::value), ""); + static_assert((std::is_same<std::true_type::type, std::true_type>::value), ""); + + std::false_type f1; + std::false_type f2 = f1; + + std::true_type t1; + std::true_type t2 = t1; +} diff --git a/libcxx/test/utilities/meta/meta.rel/is_base_of.pass.cpp b/libcxx/test/utilities/meta/meta.rel/is_base_of.pass.cpp index 319fb6cceae..2d38d5524e2 100644 --- a/libcxx/test/utilities/meta/meta.rel/is_base_of.pass.cpp +++ b/libcxx/test/utilities/meta/meta.rel/is_base_of.pass.cpp @@ -1 +1,50 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_base_of
#include <type_traits>
template <class T, class U>
void test_is_base_of()
{
static_assert((std::is_base_of<T, U>::value), "");
static_assert((std::is_base_of<const T, U>::value), "");
static_assert((std::is_base_of<T, const U>::value), "");
static_assert((std::is_base_of<const T, const U>::value), "");
}
template <class T, class U>
void test_is_not_base_of()
{
static_assert((!std::is_base_of<T, U>::value), "");
}
struct B {};
struct B1 : B {};
struct B2 : B {};
struct D : private B1, private B2 {};
int main()
{
test_is_base_of<B, D>();
test_is_base_of<B1, D>();
test_is_base_of<B2, D>();
test_is_base_of<B, B1>();
test_is_base_of<B, B2>();
test_is_base_of<B, B>();
test_is_not_base_of<D, B>();
test_is_not_base_of<B&, D&>();
test_is_not_base_of<B[3], D[3]>();
test_is_not_base_of<int, int>();
test_is_not_base_of<int, int>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_base_of + +#include <type_traits> + +template <class T, class U> +void test_is_base_of() +{ + static_assert((std::is_base_of<T, U>::value), ""); + static_assert((std::is_base_of<const T, U>::value), ""); + static_assert((std::is_base_of<T, const U>::value), ""); + static_assert((std::is_base_of<const T, const U>::value), ""); +} + +template <class T, class U> +void test_is_not_base_of() +{ + static_assert((!std::is_base_of<T, U>::value), ""); +} + +struct B {}; +struct B1 : B {}; +struct B2 : B {}; +struct D : private B1, private B2 {}; + +int main() +{ + test_is_base_of<B, D>(); + test_is_base_of<B1, D>(); + test_is_base_of<B2, D>(); + test_is_base_of<B, B1>(); + test_is_base_of<B, B2>(); + test_is_base_of<B, B>(); + + test_is_not_base_of<D, B>(); + test_is_not_base_of<B&, D&>(); + test_is_not_base_of<B[3], D[3]>(); + test_is_not_base_of<int, int>(); + test_is_not_base_of<int, int>(); +} diff --git a/libcxx/test/utilities/meta/meta.rel/is_convertible.pass.cpp b/libcxx/test/utilities/meta/meta.rel/is_convertible.pass.cpp index 96c8a5e8ac2..a77d54a2085 100644 --- a/libcxx/test/utilities/meta/meta.rel/is_convertible.pass.cpp +++ b/libcxx/test/utilities/meta/meta.rel/is_convertible.pass.cpp @@ -1 +1,369 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_convertible
#include <type_traits>
typedef void Function();
typedef char Array[1];
int main()
{
{
static_assert(( std::is_convertible<void, void>::value), "");
static_assert(( std::is_convertible<const void, void>::value), "");
static_assert(( std::is_convertible<void, const void>::value), "");
static_assert(( std::is_convertible<const void, const void>::value), "");
static_assert((!std::is_convertible<void, Function>::value), "");
static_assert((!std::is_convertible<const void, Function>::value), "");
static_assert((!std::is_convertible<void, Function&>::value), "");
static_assert((!std::is_convertible<const void, Function&>::value), "");
static_assert((!std::is_convertible<void, Function*>::value), "");
static_assert((!std::is_convertible<void, Function* const>::value), "");
static_assert((!std::is_convertible<const void, Function*>::value), "");
static_assert((!std::is_convertible<const void, Function*const >::value), "");
static_assert((!std::is_convertible<void, Array>::value), "");
static_assert((!std::is_convertible<void, const Array>::value), "");
static_assert((!std::is_convertible<const void, Array>::value), "");
static_assert((!std::is_convertible<const void, const Array>::value), "");
static_assert((!std::is_convertible<void, Array&>::value), "");
static_assert((!std::is_convertible<void, const Array&>::value), "");
static_assert((!std::is_convertible<const void, Array&>::value), "");
static_assert((!std::is_convertible<const void, const Array&>::value), "");
static_assert((!std::is_convertible<void, char>::value), "");
static_assert((!std::is_convertible<void, const char>::value), "");
static_assert((!std::is_convertible<const void, char>::value), "");
static_assert((!std::is_convertible<const void, const char>::value), "");
static_assert((!std::is_convertible<void, char&>::value), "");
static_assert((!std::is_convertible<void, const char&>::value), "");
static_assert((!std::is_convertible<const void, char&>::value), "");
static_assert((!std::is_convertible<const void, const char&>::value), "");
static_assert((!std::is_convertible<void, char*>::value), "");
static_assert((!std::is_convertible<void, const char*>::value), "");
static_assert((!std::is_convertible<const void, char*>::value), "");
static_assert((!std::is_convertible<const void, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Function, void>::value), "");
static_assert((!std::is_convertible<Function, const void>::value), "");
static_assert((!std::is_convertible<Function, Function>::value), "");
static_assert((!std::is_convertible<Function, Function&>::value), "");
static_assert((!std::is_convertible<Function, Function&>::value), "");
static_assert(( std::is_convertible<Function, Function*>::value), "");
static_assert(( std::is_convertible<Function, Function* const>::value), "");
static_assert((!std::is_convertible<Function, Array>::value), "");
static_assert((!std::is_convertible<Function, const Array>::value), "");
static_assert((!std::is_convertible<Function, Array&>::value), "");
static_assert((!std::is_convertible<Function, const Array&>::value), "");
static_assert((!std::is_convertible<Function, char>::value), "");
static_assert((!std::is_convertible<Function, const char>::value), "");
static_assert((!std::is_convertible<Function, char&>::value), "");
static_assert((!std::is_convertible<Function, const char&>::value), "");
static_assert((!std::is_convertible<Function, char*>::value), "");
static_assert((!std::is_convertible<Function, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Function&, void>::value), "");
static_assert((!std::is_convertible<Function&, const void>::value), "");
static_assert((!std::is_convertible<Function&, Function>::value), "");
static_assert(( std::is_convertible<Function&, Function&>::value), "");
static_assert(( std::is_convertible<Function&, const Function&>::value), "");
static_assert(( std::is_convertible<Function&, Function*>::value), "");
static_assert(( std::is_convertible<Function&, Function* const>::value), "");
static_assert((!std::is_convertible<Function&, Array>::value), "");
static_assert((!std::is_convertible<Function&, const Array>::value), "");
static_assert((!std::is_convertible<Function&, Array&>::value), "");
static_assert((!std::is_convertible<Function&, const Array&>::value), "");
static_assert((!std::is_convertible<Function&, char>::value), "");
static_assert((!std::is_convertible<Function&, const char>::value), "");
static_assert((!std::is_convertible<Function&, char&>::value), "");
static_assert((!std::is_convertible<Function&, const char&>::value), "");
static_assert((!std::is_convertible<Function&, char*>::value), "");
static_assert((!std::is_convertible<Function&, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Function*, void>::value), "");
static_assert((!std::is_convertible<Function*const, void>::value), "");
static_assert((!std::is_convertible<Function*, const void>::value), "");
static_assert((!std::is_convertible<Function*const, const void>::value), "");
static_assert((!std::is_convertible<Function*, Function>::value), "");
static_assert((!std::is_convertible<Function*const, Function>::value), "");
static_assert((!std::is_convertible<Function*, Function&>::value), "");
static_assert((!std::is_convertible<Function*const, Function&>::value), "");
static_assert(( std::is_convertible<Function*, Function*>::value), "");
static_assert(( std::is_convertible<Function*, Function* const>::value), "");
static_assert(( std::is_convertible<Function*const, Function*>::value), "");
static_assert(( std::is_convertible<Function*const, Function*const >::value), "");
static_assert((!std::is_convertible<Function*, Array>::value), "");
static_assert((!std::is_convertible<Function*, const Array>::value), "");
static_assert((!std::is_convertible<Function*const, Array>::value), "");
static_assert((!std::is_convertible<Function*const, const Array>::value), "");
static_assert((!std::is_convertible<Function*, Array&>::value), "");
static_assert((!std::is_convertible<Function*, const Array&>::value), "");
static_assert((!std::is_convertible<Function*const, Array&>::value), "");
static_assert((!std::is_convertible<Function*const, const Array&>::value), "");
static_assert((!std::is_convertible<Function*, char>::value), "");
static_assert((!std::is_convertible<Function*, const char>::value), "");
static_assert((!std::is_convertible<Function*const, char>::value), "");
static_assert((!std::is_convertible<Function*const, const char>::value), "");
static_assert((!std::is_convertible<Function*, char&>::value), "");
static_assert((!std::is_convertible<Function*, const char&>::value), "");
static_assert((!std::is_convertible<Function*const, char&>::value), "");
static_assert((!std::is_convertible<Function*const, const char&>::value), "");
static_assert((!std::is_convertible<Function*, char*>::value), "");
static_assert((!std::is_convertible<Function*, const char*>::value), "");
static_assert((!std::is_convertible<Function*const, char*>::value), "");
static_assert((!std::is_convertible<Function*const, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Array, void>::value), "");
static_assert((!std::is_convertible<const Array, void>::value), "");
static_assert((!std::is_convertible<Array, const void>::value), "");
static_assert((!std::is_convertible<const Array, const void>::value), "");
static_assert((!std::is_convertible<Array, Function>::value), "");
static_assert((!std::is_convertible<const Array, Function>::value), "");
static_assert((!std::is_convertible<Array, Function&>::value), "");
static_assert((!std::is_convertible<const Array, Function&>::value), "");
static_assert((!std::is_convertible<Array, Function*>::value), "");
static_assert((!std::is_convertible<Array, Function* const>::value), "");
static_assert((!std::is_convertible<const Array, Function*>::value), "");
static_assert((!std::is_convertible<const Array, Function*const >::value), "");
static_assert((!std::is_convertible<Array, Array>::value), "");
static_assert((!std::is_convertible<Array, const Array>::value), "");
static_assert((!std::is_convertible<const Array, Array>::value), "");
static_assert((!std::is_convertible<const Array, const Array>::value), "");
static_assert((!std::is_convertible<Array, Array&>::value), "");
static_assert(( std::is_convertible<Array, const Array&>::value), "");
static_assert((!std::is_convertible<const Array, Array&>::value), "");
static_assert((!std::is_convertible<const Array, const Array&>::value), "");
static_assert((!std::is_convertible<Array, char>::value), "");
static_assert((!std::is_convertible<Array, const char>::value), "");
static_assert((!std::is_convertible<const Array, char>::value), "");
static_assert((!std::is_convertible<const Array, const char>::value), "");
static_assert((!std::is_convertible<Array, char&>::value), "");
static_assert((!std::is_convertible<Array, const char&>::value), "");
static_assert((!std::is_convertible<const Array, char&>::value), "");
static_assert((!std::is_convertible<const Array, const char&>::value), "");
static_assert(( std::is_convertible<Array, char*>::value), "");
static_assert(( std::is_convertible<Array, const char*>::value), "");
static_assert((!std::is_convertible<const Array, char*>::value), "");
static_assert(( std::is_convertible<const Array, const char*>::value), "");
}
{
static_assert((!std::is_convertible<Array&, void>::value), "");
static_assert((!std::is_convertible<const Array&, void>::value), "");
static_assert((!std::is_convertible<Array&, const void>::value), "");
static_assert((!std::is_convertible<const Array&, const void>::value), "");
static_assert((!std::is_convertible<Array&, Function>::value), "");
static_assert((!std::is_convertible<const Array&, Function>::value), "");
static_assert((!std::is_convertible<Array&, Function&>::value), "");
static_assert((!std::is_convertible<const Array&, Function&>::value), "");
static_assert((!std::is_convertible<Array&, Function*>::value), "");
static_assert((!std::is_convertible<Array&, Function* const>::value), "");
static_assert((!std::is_convertible<const Array&, Function*>::value), "");
static_assert((!std::is_convertible<const Array&, Function*const >::value), "");
static_assert((!std::is_convertible<Array&, Array>::value), "");
static_assert((!std::is_convertible<Array&, const Array>::value), "");
static_assert((!std::is_convertible<const Array&, Array>::value), "");
static_assert((!std::is_convertible<const Array&, const Array>::value), "");
static_assert(( std::is_convertible<Array&, Array&>::value), "");
static_assert(( std::is_convertible<Array&, const Array&>::value), "");
static_assert((!std::is_convertible<const Array&, Array&>::value), "");
static_assert(( std::is_convertible<const Array&, const Array&>::value), "");
static_assert((!std::is_convertible<Array&, char>::value), "");
static_assert((!std::is_convertible<Array&, const char>::value), "");
static_assert((!std::is_convertible<const Array&, char>::value), "");
static_assert((!std::is_convertible<const Array&, const char>::value), "");
static_assert((!std::is_convertible<Array&, char&>::value), "");
static_assert((!std::is_convertible<Array&, const char&>::value), "");
static_assert((!std::is_convertible<const Array&, char&>::value), "");
static_assert((!std::is_convertible<const Array&, const char&>::value), "");
static_assert(( std::is_convertible<Array&, char*>::value), "");
static_assert(( std::is_convertible<Array&, const char*>::value), "");
static_assert((!std::is_convertible<const Array&, char*>::value), "");
static_assert(( std::is_convertible<const Array&, const char*>::value), "");
}
{
static_assert((!std::is_convertible<char, void>::value), "");
static_assert((!std::is_convertible<const char, void>::value), "");
static_assert((!std::is_convertible<char, const void>::value), "");
static_assert((!std::is_convertible<const char, const void>::value), "");
static_assert((!std::is_convertible<char, Function>::value), "");
static_assert((!std::is_convertible<const char, Function>::value), "");
static_assert((!std::is_convertible<char, Function&>::value), "");
static_assert((!std::is_convertible<const char, Function&>::value), "");
static_assert((!std::is_convertible<char, Function*>::value), "");
static_assert((!std::is_convertible<char, Function* const>::value), "");
static_assert((!std::is_convertible<const char, Function*>::value), "");
static_assert((!std::is_convertible<const char, Function*const >::value), "");
static_assert((!std::is_convertible<char, Array>::value), "");
static_assert((!std::is_convertible<char, const Array>::value), "");
static_assert((!std::is_convertible<const char, Array>::value), "");
static_assert((!std::is_convertible<const char, const Array>::value), "");
static_assert((!std::is_convertible<char, Array&>::value), "");
static_assert((!std::is_convertible<char, const Array&>::value), "");
static_assert((!std::is_convertible<const char, Array&>::value), "");
static_assert((!std::is_convertible<const char, const Array&>::value), "");
static_assert(( std::is_convertible<char, char>::value), "");
static_assert(( std::is_convertible<char, const char>::value), "");
static_assert(( std::is_convertible<const char, char>::value), "");
static_assert(( std::is_convertible<const char, const char>::value), "");
static_assert((!std::is_convertible<char, char&>::value), "");
static_assert(( std::is_convertible<char, const char&>::value), "");
static_assert((!std::is_convertible<const char, char&>::value), "");
static_assert(( std::is_convertible<const char, const char&>::value), "");
static_assert((!std::is_convertible<char, char*>::value), "");
static_assert((!std::is_convertible<char, const char*>::value), "");
static_assert((!std::is_convertible<const char, char*>::value), "");
static_assert((!std::is_convertible<const char, const char*>::value), "");
}
{
static_assert((!std::is_convertible<char&, void>::value), "");
static_assert((!std::is_convertible<const char&, void>::value), "");
static_assert((!std::is_convertible<char&, const void>::value), "");
static_assert((!std::is_convertible<const char&, const void>::value), "");
static_assert((!std::is_convertible<char&, Function>::value), "");
static_assert((!std::is_convertible<const char&, Function>::value), "");
static_assert((!std::is_convertible<char&, Function&>::value), "");
static_assert((!std::is_convertible<const char&, Function&>::value), "");
static_assert((!std::is_convertible<char&, Function*>::value), "");
static_assert((!std::is_convertible<char&, Function* const>::value), "");
static_assert((!std::is_convertible<const char&, Function*>::value), "");
static_assert((!std::is_convertible<const char&, Function*const >::value), "");
static_assert((!std::is_convertible<char&, Array>::value), "");
static_assert((!std::is_convertible<char&, const Array>::value), "");
static_assert((!std::is_convertible<const char&, Array>::value), "");
static_assert((!std::is_convertible<const char&, const Array>::value), "");
static_assert((!std::is_convertible<char&, Array&>::value), "");
static_assert((!std::is_convertible<char&, const Array&>::value), "");
static_assert((!std::is_convertible<const char&, Array&>::value), "");
static_assert((!std::is_convertible<const char&, const Array&>::value), "");
static_assert(( std::is_convertible<char&, char>::value), "");
static_assert(( std::is_convertible<char&, const char>::value), "");
static_assert(( std::is_convertible<const char&, char>::value), "");
static_assert(( std::is_convertible<const char&, const char>::value), "");
static_assert(( std::is_convertible<char&, char&>::value), "");
static_assert(( std::is_convertible<char&, const char&>::value), "");
static_assert((!std::is_convertible<const char&, char&>::value), "");
static_assert(( std::is_convertible<const char&, const char&>::value), "");
static_assert((!std::is_convertible<char&, char*>::value), "");
static_assert((!std::is_convertible<char&, const char*>::value), "");
static_assert((!std::is_convertible<const char&, char*>::value), "");
static_assert((!std::is_convertible<const char&, const char*>::value), "");
}
{
static_assert((!std::is_convertible<char*, void>::value), "");
static_assert((!std::is_convertible<const char*, void>::value), "");
static_assert((!std::is_convertible<char*, const void>::value), "");
static_assert((!std::is_convertible<const char*, const void>::value), "");
static_assert((!std::is_convertible<char*, Function>::value), "");
static_assert((!std::is_convertible<const char*, Function>::value), "");
static_assert((!std::is_convertible<char*, Function&>::value), "");
static_assert((!std::is_convertible<const char*, Function&>::value), "");
static_assert((!std::is_convertible<char*, Function*>::value), "");
static_assert((!std::is_convertible<char*, Function* const>::value), "");
static_assert((!std::is_convertible<const char*, Function*>::value), "");
static_assert((!std::is_convertible<const char*, Function*const >::value), "");
static_assert((!std::is_convertible<char*, Array>::value), "");
static_assert((!std::is_convertible<char*, const Array>::value), "");
static_assert((!std::is_convertible<const char*, Array>::value), "");
static_assert((!std::is_convertible<const char*, const Array>::value), "");
static_assert((!std::is_convertible<char*, Array&>::value), "");
static_assert((!std::is_convertible<char*, const Array&>::value), "");
static_assert((!std::is_convertible<const char*, Array&>::value), "");
static_assert((!std::is_convertible<const char*, const Array&>::value), "");
static_assert((!std::is_convertible<char*, char>::value), "");
static_assert((!std::is_convertible<char*, const char>::value), "");
static_assert((!std::is_convertible<const char*, char>::value), "");
static_assert((!std::is_convertible<const char*, const char>::value), "");
static_assert((!std::is_convertible<char*, char&>::value), "");
static_assert((!std::is_convertible<char*, const char&>::value), "");
static_assert((!std::is_convertible<const char*, char&>::value), "");
static_assert((!std::is_convertible<const char*, const char&>::value), "");
static_assert(( std::is_convertible<char*, char*>::value), "");
static_assert(( std::is_convertible<char*, const char*>::value), "");
static_assert((!std::is_convertible<const char*, char*>::value), "");
static_assert(( std::is_convertible<const char*, const char*>::value), "");
}
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_convertible + +#include <type_traits> + +typedef void Function(); +typedef char Array[1]; + +int main() +{ + { + static_assert(( std::is_convertible<void, void>::value), ""); + static_assert(( std::is_convertible<const void, void>::value), ""); + static_assert(( std::is_convertible<void, const void>::value), ""); + static_assert(( std::is_convertible<const void, const void>::value), ""); + + static_assert((!std::is_convertible<void, Function>::value), ""); + static_assert((!std::is_convertible<const void, Function>::value), ""); + + static_assert((!std::is_convertible<void, Function&>::value), ""); + static_assert((!std::is_convertible<const void, Function&>::value), ""); + + static_assert((!std::is_convertible<void, Function*>::value), ""); + static_assert((!std::is_convertible<void, Function* const>::value), ""); + static_assert((!std::is_convertible<const void, Function*>::value), ""); + static_assert((!std::is_convertible<const void, Function*const >::value), ""); + + static_assert((!std::is_convertible<void, Array>::value), ""); + static_assert((!std::is_convertible<void, const Array>::value), ""); + static_assert((!std::is_convertible<const void, Array>::value), ""); + static_assert((!std::is_convertible<const void, const Array>::value), ""); + + static_assert((!std::is_convertible<void, Array&>::value), ""); + static_assert((!std::is_convertible<void, const Array&>::value), ""); + static_assert((!std::is_convertible<const void, Array&>::value), ""); + static_assert((!std::is_convertible<const void, const Array&>::value), ""); + + static_assert((!std::is_convertible<void, char>::value), ""); + static_assert((!std::is_convertible<void, const char>::value), ""); + static_assert((!std::is_convertible<const void, char>::value), ""); + static_assert((!std::is_convertible<const void, const char>::value), ""); + + static_assert((!std::is_convertible<void, char&>::value), ""); + static_assert((!std::is_convertible<void, const char&>::value), ""); + static_assert((!std::is_convertible<const void, char&>::value), ""); + static_assert((!std::is_convertible<const void, const char&>::value), ""); + + static_assert((!std::is_convertible<void, char*>::value), ""); + static_assert((!std::is_convertible<void, const char*>::value), ""); + static_assert((!std::is_convertible<const void, char*>::value), ""); + static_assert((!std::is_convertible<const void, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<Function, void>::value), ""); + static_assert((!std::is_convertible<Function, const void>::value), ""); + + static_assert((!std::is_convertible<Function, Function>::value), ""); + + static_assert((!std::is_convertible<Function, Function&>::value), ""); + static_assert((!std::is_convertible<Function, Function&>::value), ""); + + static_assert(( std::is_convertible<Function, Function*>::value), ""); + static_assert(( std::is_convertible<Function, Function* const>::value), ""); + + static_assert((!std::is_convertible<Function, Array>::value), ""); + static_assert((!std::is_convertible<Function, const Array>::value), ""); + + static_assert((!std::is_convertible<Function, Array&>::value), ""); + static_assert((!std::is_convertible<Function, const Array&>::value), ""); + + static_assert((!std::is_convertible<Function, char>::value), ""); + static_assert((!std::is_convertible<Function, const char>::value), ""); + + static_assert((!std::is_convertible<Function, char&>::value), ""); + static_assert((!std::is_convertible<Function, const char&>::value), ""); + + static_assert((!std::is_convertible<Function, char*>::value), ""); + static_assert((!std::is_convertible<Function, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<Function&, void>::value), ""); + static_assert((!std::is_convertible<Function&, const void>::value), ""); + + static_assert((!std::is_convertible<Function&, Function>::value), ""); + + static_assert(( std::is_convertible<Function&, Function&>::value), ""); + static_assert(( std::is_convertible<Function&, const Function&>::value), ""); + + static_assert(( std::is_convertible<Function&, Function*>::value), ""); + static_assert(( std::is_convertible<Function&, Function* const>::value), ""); + + static_assert((!std::is_convertible<Function&, Array>::value), ""); + static_assert((!std::is_convertible<Function&, const Array>::value), ""); + + static_assert((!std::is_convertible<Function&, Array&>::value), ""); + static_assert((!std::is_convertible<Function&, const Array&>::value), ""); + + static_assert((!std::is_convertible<Function&, char>::value), ""); + static_assert((!std::is_convertible<Function&, const char>::value), ""); + + static_assert((!std::is_convertible<Function&, char&>::value), ""); + static_assert((!std::is_convertible<Function&, const char&>::value), ""); + + static_assert((!std::is_convertible<Function&, char*>::value), ""); + static_assert((!std::is_convertible<Function&, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<Function*, void>::value), ""); + static_assert((!std::is_convertible<Function*const, void>::value), ""); + static_assert((!std::is_convertible<Function*, const void>::value), ""); + static_assert((!std::is_convertible<Function*const, const void>::value), ""); + + static_assert((!std::is_convertible<Function*, Function>::value), ""); + static_assert((!std::is_convertible<Function*const, Function>::value), ""); + + static_assert((!std::is_convertible<Function*, Function&>::value), ""); + static_assert((!std::is_convertible<Function*const, Function&>::value), ""); + + static_assert(( std::is_convertible<Function*, Function*>::value), ""); + static_assert(( std::is_convertible<Function*, Function* const>::value), ""); + static_assert(( std::is_convertible<Function*const, Function*>::value), ""); + static_assert(( std::is_convertible<Function*const, Function*const >::value), ""); + + static_assert((!std::is_convertible<Function*, Array>::value), ""); + static_assert((!std::is_convertible<Function*, const Array>::value), ""); + static_assert((!std::is_convertible<Function*const, Array>::value), ""); + static_assert((!std::is_convertible<Function*const, const Array>::value), ""); + + static_assert((!std::is_convertible<Function*, Array&>::value), ""); + static_assert((!std::is_convertible<Function*, const Array&>::value), ""); + static_assert((!std::is_convertible<Function*const, Array&>::value), ""); + static_assert((!std::is_convertible<Function*const, const Array&>::value), ""); + + static_assert((!std::is_convertible<Function*, char>::value), ""); + static_assert((!std::is_convertible<Function*, const char>::value), ""); + static_assert((!std::is_convertible<Function*const, char>::value), ""); + static_assert((!std::is_convertible<Function*const, const char>::value), ""); + + static_assert((!std::is_convertible<Function*, char&>::value), ""); + static_assert((!std::is_convertible<Function*, const char&>::value), ""); + static_assert((!std::is_convertible<Function*const, char&>::value), ""); + static_assert((!std::is_convertible<Function*const, const char&>::value), ""); + + static_assert((!std::is_convertible<Function*, char*>::value), ""); + static_assert((!std::is_convertible<Function*, const char*>::value), ""); + static_assert((!std::is_convertible<Function*const, char*>::value), ""); + static_assert((!std::is_convertible<Function*const, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<Array, void>::value), ""); + static_assert((!std::is_convertible<const Array, void>::value), ""); + static_assert((!std::is_convertible<Array, const void>::value), ""); + static_assert((!std::is_convertible<const Array, const void>::value), ""); + + static_assert((!std::is_convertible<Array, Function>::value), ""); + static_assert((!std::is_convertible<const Array, Function>::value), ""); + + static_assert((!std::is_convertible<Array, Function&>::value), ""); + static_assert((!std::is_convertible<const Array, Function&>::value), ""); + + static_assert((!std::is_convertible<Array, Function*>::value), ""); + static_assert((!std::is_convertible<Array, Function* const>::value), ""); + static_assert((!std::is_convertible<const Array, Function*>::value), ""); + static_assert((!std::is_convertible<const Array, Function*const >::value), ""); + + static_assert((!std::is_convertible<Array, Array>::value), ""); + static_assert((!std::is_convertible<Array, const Array>::value), ""); + static_assert((!std::is_convertible<const Array, Array>::value), ""); + static_assert((!std::is_convertible<const Array, const Array>::value), ""); + + static_assert((!std::is_convertible<Array, Array&>::value), ""); + static_assert(( std::is_convertible<Array, const Array&>::value), ""); + static_assert((!std::is_convertible<const Array, Array&>::value), ""); + static_assert((!std::is_convertible<const Array, const Array&>::value), ""); + + static_assert((!std::is_convertible<Array, char>::value), ""); + static_assert((!std::is_convertible<Array, const char>::value), ""); + static_assert((!std::is_convertible<const Array, char>::value), ""); + static_assert((!std::is_convertible<const Array, const char>::value), ""); + + static_assert((!std::is_convertible<Array, char&>::value), ""); + static_assert((!std::is_convertible<Array, const char&>::value), ""); + static_assert((!std::is_convertible<const Array, char&>::value), ""); + static_assert((!std::is_convertible<const Array, const char&>::value), ""); + + static_assert(( std::is_convertible<Array, char*>::value), ""); + static_assert(( std::is_convertible<Array, const char*>::value), ""); + static_assert((!std::is_convertible<const Array, char*>::value), ""); + static_assert(( std::is_convertible<const Array, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<Array&, void>::value), ""); + static_assert((!std::is_convertible<const Array&, void>::value), ""); + static_assert((!std::is_convertible<Array&, const void>::value), ""); + static_assert((!std::is_convertible<const Array&, const void>::value), ""); + + static_assert((!std::is_convertible<Array&, Function>::value), ""); + static_assert((!std::is_convertible<const Array&, Function>::value), ""); + + static_assert((!std::is_convertible<Array&, Function&>::value), ""); + static_assert((!std::is_convertible<const Array&, Function&>::value), ""); + + static_assert((!std::is_convertible<Array&, Function*>::value), ""); + static_assert((!std::is_convertible<Array&, Function* const>::value), ""); + static_assert((!std::is_convertible<const Array&, Function*>::value), ""); + static_assert((!std::is_convertible<const Array&, Function*const >::value), ""); + + static_assert((!std::is_convertible<Array&, Array>::value), ""); + static_assert((!std::is_convertible<Array&, const Array>::value), ""); + static_assert((!std::is_convertible<const Array&, Array>::value), ""); + static_assert((!std::is_convertible<const Array&, const Array>::value), ""); + + static_assert(( std::is_convertible<Array&, Array&>::value), ""); + static_assert(( std::is_convertible<Array&, const Array&>::value), ""); + static_assert((!std::is_convertible<const Array&, Array&>::value), ""); + static_assert(( std::is_convertible<const Array&, const Array&>::value), ""); + + static_assert((!std::is_convertible<Array&, char>::value), ""); + static_assert((!std::is_convertible<Array&, const char>::value), ""); + static_assert((!std::is_convertible<const Array&, char>::value), ""); + static_assert((!std::is_convertible<const Array&, const char>::value), ""); + + static_assert((!std::is_convertible<Array&, char&>::value), ""); + static_assert((!std::is_convertible<Array&, const char&>::value), ""); + static_assert((!std::is_convertible<const Array&, char&>::value), ""); + static_assert((!std::is_convertible<const Array&, const char&>::value), ""); + + static_assert(( std::is_convertible<Array&, char*>::value), ""); + static_assert(( std::is_convertible<Array&, const char*>::value), ""); + static_assert((!std::is_convertible<const Array&, char*>::value), ""); + static_assert(( std::is_convertible<const Array&, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<char, void>::value), ""); + static_assert((!std::is_convertible<const char, void>::value), ""); + static_assert((!std::is_convertible<char, const void>::value), ""); + static_assert((!std::is_convertible<const char, const void>::value), ""); + + static_assert((!std::is_convertible<char, Function>::value), ""); + static_assert((!std::is_convertible<const char, Function>::value), ""); + + static_assert((!std::is_convertible<char, Function&>::value), ""); + static_assert((!std::is_convertible<const char, Function&>::value), ""); + + static_assert((!std::is_convertible<char, Function*>::value), ""); + static_assert((!std::is_convertible<char, Function* const>::value), ""); + static_assert((!std::is_convertible<const char, Function*>::value), ""); + static_assert((!std::is_convertible<const char, Function*const >::value), ""); + + static_assert((!std::is_convertible<char, Array>::value), ""); + static_assert((!std::is_convertible<char, const Array>::value), ""); + static_assert((!std::is_convertible<const char, Array>::value), ""); + static_assert((!std::is_convertible<const char, const Array>::value), ""); + + static_assert((!std::is_convertible<char, Array&>::value), ""); + static_assert((!std::is_convertible<char, const Array&>::value), ""); + static_assert((!std::is_convertible<const char, Array&>::value), ""); + static_assert((!std::is_convertible<const char, const Array&>::value), ""); + + static_assert(( std::is_convertible<char, char>::value), ""); + static_assert(( std::is_convertible<char, const char>::value), ""); + static_assert(( std::is_convertible<const char, char>::value), ""); + static_assert(( std::is_convertible<const char, const char>::value), ""); + + static_assert((!std::is_convertible<char, char&>::value), ""); + static_assert(( std::is_convertible<char, const char&>::value), ""); + static_assert((!std::is_convertible<const char, char&>::value), ""); + static_assert(( std::is_convertible<const char, const char&>::value), ""); + + static_assert((!std::is_convertible<char, char*>::value), ""); + static_assert((!std::is_convertible<char, const char*>::value), ""); + static_assert((!std::is_convertible<const char, char*>::value), ""); + static_assert((!std::is_convertible<const char, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<char&, void>::value), ""); + static_assert((!std::is_convertible<const char&, void>::value), ""); + static_assert((!std::is_convertible<char&, const void>::value), ""); + static_assert((!std::is_convertible<const char&, const void>::value), ""); + + static_assert((!std::is_convertible<char&, Function>::value), ""); + static_assert((!std::is_convertible<const char&, Function>::value), ""); + + static_assert((!std::is_convertible<char&, Function&>::value), ""); + static_assert((!std::is_convertible<const char&, Function&>::value), ""); + + static_assert((!std::is_convertible<char&, Function*>::value), ""); + static_assert((!std::is_convertible<char&, Function* const>::value), ""); + static_assert((!std::is_convertible<const char&, Function*>::value), ""); + static_assert((!std::is_convertible<const char&, Function*const >::value), ""); + + static_assert((!std::is_convertible<char&, Array>::value), ""); + static_assert((!std::is_convertible<char&, const Array>::value), ""); + static_assert((!std::is_convertible<const char&, Array>::value), ""); + static_assert((!std::is_convertible<const char&, const Array>::value), ""); + + static_assert((!std::is_convertible<char&, Array&>::value), ""); + static_assert((!std::is_convertible<char&, const Array&>::value), ""); + static_assert((!std::is_convertible<const char&, Array&>::value), ""); + static_assert((!std::is_convertible<const char&, const Array&>::value), ""); + + static_assert(( std::is_convertible<char&, char>::value), ""); + static_assert(( std::is_convertible<char&, const char>::value), ""); + static_assert(( std::is_convertible<const char&, char>::value), ""); + static_assert(( std::is_convertible<const char&, const char>::value), ""); + + static_assert(( std::is_convertible<char&, char&>::value), ""); + static_assert(( std::is_convertible<char&, const char&>::value), ""); + static_assert((!std::is_convertible<const char&, char&>::value), ""); + static_assert(( std::is_convertible<const char&, const char&>::value), ""); + + static_assert((!std::is_convertible<char&, char*>::value), ""); + static_assert((!std::is_convertible<char&, const char*>::value), ""); + static_assert((!std::is_convertible<const char&, char*>::value), ""); + static_assert((!std::is_convertible<const char&, const char*>::value), ""); + } + { + static_assert((!std::is_convertible<char*, void>::value), ""); + static_assert((!std::is_convertible<const char*, void>::value), ""); + static_assert((!std::is_convertible<char*, const void>::value), ""); + static_assert((!std::is_convertible<const char*, const void>::value), ""); + + static_assert((!std::is_convertible<char*, Function>::value), ""); + static_assert((!std::is_convertible<const char*, Function>::value), ""); + + static_assert((!std::is_convertible<char*, Function&>::value), ""); + static_assert((!std::is_convertible<const char*, Function&>::value), ""); + + static_assert((!std::is_convertible<char*, Function*>::value), ""); + static_assert((!std::is_convertible<char*, Function* const>::value), ""); + static_assert((!std::is_convertible<const char*, Function*>::value), ""); + static_assert((!std::is_convertible<const char*, Function*const >::value), ""); + + static_assert((!std::is_convertible<char*, Array>::value), ""); + static_assert((!std::is_convertible<char*, const Array>::value), ""); + static_assert((!std::is_convertible<const char*, Array>::value), ""); + static_assert((!std::is_convertible<const char*, const Array>::value), ""); + + static_assert((!std::is_convertible<char*, Array&>::value), ""); + static_assert((!std::is_convertible<char*, const Array&>::value), ""); + static_assert((!std::is_convertible<const char*, Array&>::value), ""); + static_assert((!std::is_convertible<const char*, const Array&>::value), ""); + + static_assert((!std::is_convertible<char*, char>::value), ""); + static_assert((!std::is_convertible<char*, const char>::value), ""); + static_assert((!std::is_convertible<const char*, char>::value), ""); + static_assert((!std::is_convertible<const char*, const char>::value), ""); + + static_assert((!std::is_convertible<char*, char&>::value), ""); + static_assert((!std::is_convertible<char*, const char&>::value), ""); + static_assert((!std::is_convertible<const char*, char&>::value), ""); + static_assert((!std::is_convertible<const char*, const char&>::value), ""); + + static_assert(( std::is_convertible<char*, char*>::value), ""); + static_assert(( std::is_convertible<char*, const char*>::value), ""); + static_assert((!std::is_convertible<const char*, char*>::value), ""); + static_assert(( std::is_convertible<const char*, const char*>::value), ""); + } +} diff --git a/libcxx/test/utilities/meta/meta.rel/is_same.pass.cpp b/libcxx/test/utilities/meta/meta.rel/is_same.pass.cpp index 8fa8e556d7c..e75a8d03768 100644 --- a/libcxx/test/utilities/meta/meta.rel/is_same.pass.cpp +++ b/libcxx/test/utilities/meta/meta.rel/is_same.pass.cpp @@ -1 +1,59 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_same
#include <type_traits>
template <class T, class U>
void test_is_same()
{
static_assert((std::is_same<T, U>::value), "");
static_assert((!std::is_same<const T, U>::value), "");
static_assert((!std::is_same<T, const U>::value), "");
static_assert((std::is_same<const T, const U>::value), "");
}
template <class T, class U>
void test_is_same_ref()
{
static_assert((std::is_same<T, U>::value), "");
static_assert((std::is_same<const T, U>::value), "");
static_assert((std::is_same<T, const U>::value), "");
static_assert((std::is_same<const T, const U>::value), "");
}
template <class T, class U>
void test_is_not_same()
{
static_assert((!std::is_same<T, U>::value), "");
}
class Class
{
public:
~Class();
};
int main()
{
test_is_same<int, int>();
test_is_same<void, void>();
test_is_same<Class, Class>();
test_is_same<int*, int*>();
test_is_same_ref<int&, int&>();
test_is_not_same<int, void>();
test_is_not_same<void, Class>();
test_is_not_same<Class, int*>();
test_is_not_same<int*, int&>();
test_is_not_same<int&, int>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_same + +#include <type_traits> + +template <class T, class U> +void test_is_same() +{ + static_assert((std::is_same<T, U>::value), ""); + static_assert((!std::is_same<const T, U>::value), ""); + static_assert((!std::is_same<T, const U>::value), ""); + static_assert((std::is_same<const T, const U>::value), ""); +} + +template <class T, class U> +void test_is_same_ref() +{ + static_assert((std::is_same<T, U>::value), ""); + static_assert((std::is_same<const T, U>::value), ""); + static_assert((std::is_same<T, const U>::value), ""); + static_assert((std::is_same<const T, const U>::value), ""); +} + +template <class T, class U> +void test_is_not_same() +{ + static_assert((!std::is_same<T, U>::value), ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_same<int, int>(); + test_is_same<void, void>(); + test_is_same<Class, Class>(); + test_is_same<int*, int*>(); + test_is_same_ref<int&, int&>(); + + test_is_not_same<int, void>(); + test_is_not_same<void, Class>(); + test_is_not_same<Class, int*>(); + test_is_not_same<int*, int&>(); + test_is_not_same<int&, int>(); +} diff --git a/libcxx/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp b/libcxx/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp index e8db90cbee0..b89f168e9c4 100644 --- a/libcxx/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp +++ b/libcxx/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp @@ -1 +1,12 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp index 51e5178cfd9..23b7646c3bb 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp @@ -1 +1,32 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_all_extents
#include <type_traits>
enum Enum {zero, one_};
int main()
{
static_assert((std::is_same<std::remove_all_extents<int>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const Enum>::type, const Enum>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[3]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[][3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[][3]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[2][3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[2][3]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_all_extents<int[1][2][3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_all_extents<const int[1][2][3]>::type, const int>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_all_extents + +#include <type_traits> + +enum Enum {zero, one_}; + +int main() +{ + static_assert((std::is_same<std::remove_all_extents<int>::type, int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<const Enum>::type, const Enum>::value), ""); + static_assert((std::is_same<std::remove_all_extents<int[]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<const int[]>::type, const int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<int[3]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<const int[3]>::type, const int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<int[][3]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<const int[][3]>::type, const int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<int[2][3]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<const int[2][3]>::type, const int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<int[1][2][3]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_all_extents<const int[1][2][3]>::type, const int>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp index d6592e88377..3f7d07a7466 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp @@ -1 +1,32 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_extent
#include <type_traits>
enum Enum {zero, one_};
int main()
{
static_assert((std::is_same<std::remove_extent<int>::type, int>::value), "");
static_assert((std::is_same<std::remove_extent<const Enum>::type, const Enum>::value), "");
static_assert((std::is_same<std::remove_extent<int[]>::type, int>::value), "");
static_assert((std::is_same<std::remove_extent<const int[]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_extent<int[3]>::type, int>::value), "");
static_assert((std::is_same<std::remove_extent<const int[3]>::type, const int>::value), "");
static_assert((std::is_same<std::remove_extent<int[][3]>::type, int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<const int[][3]>::type, const int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<int[2][3]>::type, int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<const int[2][3]>::type, const int[3]>::value), "");
static_assert((std::is_same<std::remove_extent<int[1][2][3]>::type, int[2][3]>::value), "");
static_assert((std::is_same<std::remove_extent<const int[1][2][3]>::type, const int[2][3]>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_extent + +#include <type_traits> + +enum Enum {zero, one_}; + +int main() +{ + static_assert((std::is_same<std::remove_extent<int>::type, int>::value), ""); + static_assert((std::is_same<std::remove_extent<const Enum>::type, const Enum>::value), ""); + static_assert((std::is_same<std::remove_extent<int[]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_extent<const int[]>::type, const int>::value), ""); + static_assert((std::is_same<std::remove_extent<int[3]>::type, int>::value), ""); + static_assert((std::is_same<std::remove_extent<const int[3]>::type, const int>::value), ""); + static_assert((std::is_same<std::remove_extent<int[][3]>::type, int[3]>::value), ""); + static_assert((std::is_same<std::remove_extent<const int[][3]>::type, const int[3]>::value), ""); + static_assert((std::is_same<std::remove_extent<int[2][3]>::type, int[3]>::value), ""); + static_assert((std::is_same<std::remove_extent<const int[2][3]>::type, const int[3]>::value), ""); + static_assert((std::is_same<std::remove_extent<int[1][2][3]>::type, int[2][3]>::value), ""); + static_assert((std::is_same<std::remove_extent<const int[1][2][3]>::type, const int[2][3]>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp index 55767898c33..f9f20dfdf6c 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_const
#include <type_traits>
template <class T, class U>
void test_add_const_imp()
{
static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), "");
}
template <class T>
void test_add_const()
{
test_add_const_imp<T, const T>();
test_add_const_imp<const T, const T>();
test_add_const_imp<volatile T, volatile const T>();
test_add_const_imp<const volatile T, const volatile T>();
}
int main()
{
test_add_const<void>();
test_add_const<int>();
test_add_const<int[3]>();
test_add_const<int&>();
test_add_const<const int&>();
test_add_const<int*>();
test_add_const<const int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_const + +#include <type_traits> + +template <class T, class U> +void test_add_const_imp() +{ + static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), ""); +} + +template <class T> +void test_add_const() +{ + test_add_const_imp<T, const T>(); + test_add_const_imp<const T, const T>(); + test_add_const_imp<volatile T, volatile const T>(); + test_add_const_imp<const volatile T, const volatile T>(); +} + +int main() +{ + test_add_const<void>(); + test_add_const<int>(); + test_add_const<int[3]>(); + test_add_const<int&>(); + test_add_const<const int&>(); + test_add_const<int*>(); + test_add_const<const int*>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp index 43f516eab71..ae87afb5f1d 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_cv
#include <type_traits>
template <class T, class U>
void test_add_cv_imp()
{
static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
}
template <class T>
void test_add_cv()
{
test_add_cv_imp<T, const volatile T>();
test_add_cv_imp<const T, const volatile T>();
test_add_cv_imp<volatile T, volatile const T>();
test_add_cv_imp<const volatile T, const volatile T>();
}
int main()
{
test_add_cv<void>();
test_add_cv<int>();
test_add_cv<int[3]>();
test_add_cv<int&>();
test_add_cv<const int&>();
test_add_cv<int*>();
test_add_cv<const int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_cv + +#include <type_traits> + +template <class T, class U> +void test_add_cv_imp() +{ + static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), ""); +} + +template <class T> +void test_add_cv() +{ + test_add_cv_imp<T, const volatile T>(); + test_add_cv_imp<const T, const volatile T>(); + test_add_cv_imp<volatile T, volatile const T>(); + test_add_cv_imp<const volatile T, const volatile T>(); +} + +int main() +{ + test_add_cv<void>(); + test_add_cv<int>(); + test_add_cv<int[3]>(); + test_add_cv<int&>(); + test_add_cv<const int&>(); + test_add_cv<int*>(); + test_add_cv<const int*>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp index cca30035925..fd82f953d30 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_volatile
#include <type_traits>
template <class T, class U>
void test_add_volatile_imp()
{
static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), "");
}
template <class T>
void test_add_volatile()
{
test_add_volatile_imp<T, volatile T>();
test_add_volatile_imp<const T, const volatile T>();
test_add_volatile_imp<volatile T, volatile T>();
test_add_volatile_imp<const volatile T, const volatile T>();
}
int main()
{
test_add_volatile<void>();
test_add_volatile<int>();
test_add_volatile<int[3]>();
test_add_volatile<int&>();
test_add_volatile<const int&>();
test_add_volatile<int*>();
test_add_volatile<const int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_volatile + +#include <type_traits> + +template <class T, class U> +void test_add_volatile_imp() +{ + static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), ""); +} + +template <class T> +void test_add_volatile() +{ + test_add_volatile_imp<T, volatile T>(); + test_add_volatile_imp<const T, const volatile T>(); + test_add_volatile_imp<volatile T, volatile T>(); + test_add_volatile_imp<const volatile T, const volatile T>(); +} + +int main() +{ + test_add_volatile<void>(); + test_add_volatile<int>(); + test_add_volatile<int[3]>(); + test_add_volatile<int&>(); + test_add_volatile<const int&>(); + test_add_volatile<int*>(); + test_add_volatile<const int*>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp index 4ecfcb8930d..f49a2b7092a 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_const
#include <type_traits>
template <class T, class U>
void test_remove_const_imp()
{
static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
}
template <class T>
void test_remove_const()
{
test_remove_const_imp<T, T>();
test_remove_const_imp<const T, T>();
test_remove_const_imp<volatile T, volatile T>();
test_remove_const_imp<const volatile T, volatile T>();
}
int main()
{
test_remove_const<void>();
test_remove_const<int>();
test_remove_const<int[3]>();
test_remove_const<int&>();
test_remove_const<const int&>();
test_remove_const<int*>();
test_remove_const<const int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_const + +#include <type_traits> + +template <class T, class U> +void test_remove_const_imp() +{ + static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), ""); +} + +template <class T> +void test_remove_const() +{ + test_remove_const_imp<T, T>(); + test_remove_const_imp<const T, T>(); + test_remove_const_imp<volatile T, volatile T>(); + test_remove_const_imp<const volatile T, volatile T>(); +} + +int main() +{ + test_remove_const<void>(); + test_remove_const<int>(); + test_remove_const<int[3]>(); + test_remove_const<int&>(); + test_remove_const<const int&>(); + test_remove_const<int*>(); + test_remove_const<const int*>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp index fc5b36f4f68..137e093de30 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_cv
#include <type_traits>
template <class T, class U>
void test_remove_cv_imp()
{
static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), "");
}
template <class T>
void test_remove_cv()
{
test_remove_cv_imp<T, T>();
test_remove_cv_imp<const T, T>();
test_remove_cv_imp<volatile T, T>();
test_remove_cv_imp<const volatile T, T>();
}
int main()
{
test_remove_cv<void>();
test_remove_cv<int>();
test_remove_cv<int[3]>();
test_remove_cv<int&>();
test_remove_cv<const int&>();
test_remove_cv<int*>();
test_remove_cv<const int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_cv + +#include <type_traits> + +template <class T, class U> +void test_remove_cv_imp() +{ + static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), ""); +} + +template <class T> +void test_remove_cv() +{ + test_remove_cv_imp<T, T>(); + test_remove_cv_imp<const T, T>(); + test_remove_cv_imp<volatile T, T>(); + test_remove_cv_imp<const volatile T, T>(); +} + +int main() +{ + test_remove_cv<void>(); + test_remove_cv<int>(); + test_remove_cv<int[3]>(); + test_remove_cv<int&>(); + test_remove_cv<const int&>(); + test_remove_cv<int*>(); + test_remove_cv<const int*>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp index 85d65213c08..7c829433488 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_volatile
#include <type_traits>
template <class T, class U>
void test_remove_volatile_imp()
{
static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), "");
}
template <class T>
void test_remove_volatile()
{
test_remove_volatile_imp<T, T>();
test_remove_volatile_imp<const T, const T>();
test_remove_volatile_imp<volatile T, T>();
test_remove_volatile_imp<const volatile T, const T>();
}
int main()
{
test_remove_volatile<void>();
test_remove_volatile<int>();
test_remove_volatile<int[3]>();
test_remove_volatile<int&>();
test_remove_volatile<const int&>();
test_remove_volatile<int*>();
test_remove_volatile<volatile int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_volatile + +#include <type_traits> + +template <class T, class U> +void test_remove_volatile_imp() +{ + static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), ""); +} + +template <class T> +void test_remove_volatile() +{ + test_remove_volatile_imp<T, T>(); + test_remove_volatile_imp<const T, const T>(); + test_remove_volatile_imp<volatile T, T>(); + test_remove_volatile_imp<const volatile T, const T>(); +} + +int main() +{ + test_remove_volatile<void>(); + test_remove_volatile<int>(); + test_remove_volatile<int[3]>(); + test_remove_volatile<int&>(); + test_remove_volatile<const int&>(); + test_remove_volatile<int*>(); + test_remove_volatile<volatile int*>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp index 58be6e98024..55153de8efb 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -1 +1,123 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// aligned_storage
#include <type_traits>
int main()
{
{
typedef std::aligned_storage<10, 1 >::type T1;
static_assert(std::alignment_of<T1>::value == 1, "");
static_assert(sizeof(T1) == 10, "");
}
{
typedef std::aligned_storage<10, 2 >::type T1;
static_assert(std::alignment_of<T1>::value == 2, "");
static_assert(sizeof(T1) == 10, "");
}
{
typedef std::aligned_storage<10, 4 >::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 12, "");
}
{
typedef std::aligned_storage<10, 8 >::type T1;
static_assert(std::alignment_of<T1>::value == 8, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<10, 16 >::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<10, 32 >::type T1;
static_assert(std::alignment_of<T1>::value == 32, "");
static_assert(sizeof(T1) == 32, "");
}
{
typedef std::aligned_storage<20, 32 >::type T1;
static_assert(std::alignment_of<T1>::value == 32, "");
static_assert(sizeof(T1) == 32, "");
}
{
typedef std::aligned_storage<40, 32 >::type T1;
static_assert(std::alignment_of<T1>::value == 32, "");
static_assert(sizeof(T1) == 64, "");
}
{
typedef std::aligned_storage<12, 16 >::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<1>::type T1;
static_assert(std::alignment_of<T1>::value == 1, "");
static_assert(sizeof(T1) == 1, "");
}
{
typedef std::aligned_storage<2>::type T1;
static_assert(std::alignment_of<T1>::value == 2, "");
static_assert(sizeof(T1) == 2, "");
}
{
typedef std::aligned_storage<3>::type T1;
static_assert(std::alignment_of<T1>::value == 2, "");
static_assert(sizeof(T1) == 4, "");
}
{
typedef std::aligned_storage<4>::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 4, "");
}
{
typedef std::aligned_storage<5>::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<7>::type T1;
static_assert(std::alignment_of<T1>::value == 4, "");
static_assert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<8>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<9>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
}
{
typedef std::aligned_storage<15>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<16>::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<17>::type T1;
static_assert(std::alignment_of<T1>::value == 16, "");
static_assert(sizeof(T1) == 32, "");
}
{
typedef std::aligned_storage<10>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
}
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// aligned_storage + +#include <type_traits> + +int main() +{ + { + typedef std::aligned_storage<10, 1 >::type T1; + static_assert(std::alignment_of<T1>::value == 1, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_storage<10, 2 >::type T1; + static_assert(std::alignment_of<T1>::value == 2, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_storage<10, 4 >::type T1; + static_assert(std::alignment_of<T1>::value == 4, ""); + static_assert(sizeof(T1) == 12, ""); + } + { + typedef std::aligned_storage<10, 8 >::type T1; + static_assert(std::alignment_of<T1>::value == 8, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<10, 16 >::type T1; + static_assert(std::alignment_of<T1>::value == 16, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<10, 32 >::type T1; + static_assert(std::alignment_of<T1>::value == 32, ""); + static_assert(sizeof(T1) == 32, ""); + } + { + typedef std::aligned_storage<20, 32 >::type T1; + static_assert(std::alignment_of<T1>::value == 32, ""); + static_assert(sizeof(T1) == 32, ""); + } + { + typedef std::aligned_storage<40, 32 >::type T1; + static_assert(std::alignment_of<T1>::value == 32, ""); + static_assert(sizeof(T1) == 64, ""); + } + { + typedef std::aligned_storage<12, 16 >::type T1; + static_assert(std::alignment_of<T1>::value == 16, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<1>::type T1; + static_assert(std::alignment_of<T1>::value == 1, ""); + static_assert(sizeof(T1) == 1, ""); + } + { + typedef std::aligned_storage<2>::type T1; + static_assert(std::alignment_of<T1>::value == 2, ""); + static_assert(sizeof(T1) == 2, ""); + } + { + typedef std::aligned_storage<3>::type T1; + static_assert(std::alignment_of<T1>::value == 2, ""); + static_assert(sizeof(T1) == 4, ""); + } + { + typedef std::aligned_storage<4>::type T1; + static_assert(std::alignment_of<T1>::value == 4, ""); + static_assert(sizeof(T1) == 4, ""); + } + { + typedef std::aligned_storage<5>::type T1; + static_assert(std::alignment_of<T1>::value == 4, ""); + static_assert(sizeof(T1) == 8, ""); + } + { + typedef std::aligned_storage<7>::type T1; + static_assert(std::alignment_of<T1>::value == 4, ""); + static_assert(sizeof(T1) == 8, ""); + } + { + typedef std::aligned_storage<8>::type T1; + static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); + static_assert(sizeof(T1) == 8, ""); + } + { + typedef std::aligned_storage<9>::type T1; + static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); + static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), ""); + } + { + typedef std::aligned_storage<15>::type T1; + static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<16>::type T1; + static_assert(std::alignment_of<T1>::value == 16, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<17>::type T1; + static_assert(std::alignment_of<T1>::value == 16, ""); + static_assert(sizeof(T1) == 32, ""); + } + { + typedef std::aligned_storage<10>::type T1; + static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); + static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), ""); + } +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp index 460f734a7b2..cc9e6a9d120 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp @@ -1 +1,26 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// common_type
#include <type_traits>
int main()
{
static_assert((std::is_same<std::common_type<int>::type, int>::value), "");
static_assert((std::is_same<std::common_type<char>::type, char>::value), "");
static_assert((std::is_same<std::common_type<double, char>::type, double>::value), "");
static_assert((std::is_same<std::common_type<short, char>::type, int>::value), "");
static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), "");
static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// common_type + +#include <type_traits> + +int main() +{ + static_assert((std::is_same<std::common_type<int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<char>::type, char>::value), ""); + + static_assert((std::is_same<std::common_type<double, char>::type, double>::value), ""); + static_assert((std::is_same<std::common_type<short, char>::type, int>::value), ""); + + static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), ""); + static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp index c6317037a02..575814859f2 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp @@ -1 +1,20 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// conditional
#include <type_traits>
int main()
{
static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), "");
static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// conditional + +#include <type_traits> + +int main() +{ + static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), ""); + static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp index 6ed6da8f804..a1cc8ec18e6 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp @@ -1 +1,31 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// decay
#include <type_traits>
template <class T, class U>
void test_decay()
{
static_assert((std::is_same<typename std::decay<T>::type, U>::value), "");
}
int main()
{
test_decay<void, void>();
test_decay<int, int>();
test_decay<const volatile int, int>();
test_decay<int*, int*>();
test_decay<int[3], int*>();
test_decay<const int[3], const int*>();
test_decay<void(), void (*)()>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// decay + +#include <type_traits> + +template <class T, class U> +void test_decay() +{ + static_assert((std::is_same<typename std::decay<T>::type, U>::value), ""); +} + +int main() +{ + test_decay<void, void>(); + test_decay<int, int>(); + test_decay<const volatile int, int>(); + test_decay<int*, int*>(); + test_decay<int[3], int*>(); + test_decay<const int[3], const int*>(); + test_decay<void(), void (*)()>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp index c4d27dc6b8e..d3a37dad10e 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp @@ -1 +1,19 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enable_if
#include <type_traits>
int main()
{
typedef std::enable_if<false>::type A;
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enable_if + +#include <type_traits> + +int main() +{ + typedef std::enable_if<false>::type A; +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp index 7cfdeeecfcb..f39719e2594 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp @@ -1 +1,20 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enable_if
#include <type_traits>
int main()
{
static_assert((std::is_same<std::enable_if<true>::type, void>::value), "");
static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enable_if + +#include <type_traits> + +int main() +{ + static_assert((std::is_same<std::enable_if<true>::type, void>::value), ""); + static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp index b1468de648a..b18b30b621b 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp @@ -1 +1,39 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// result_of<Fn(ArgTypes...)>
#include <type_traits>
#include <memory>
typedef bool (&PF1)();
typedef short (*PF2)(long);
struct S
{
operator PF2() const;
double operator()(char, int&);
void calc(long) const;
char data_;
};
typedef void (S::*PMS)(long) const;
typedef char S::*PMD;
int main()
{
static_assert((std::is_same<std::result_of<S(int)>::type, short>::value), "Error!");
static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!");
// static_assert(std::is_same<std::result_of<PMS(std::unique_ptr<S>, int)>::type, void>::value, "Error!");
// static_assert(std::is_same<std::result_of<PMD(S)>::type, char&&>::value, "Error!");
// static_assert(std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value, "Error!");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <functional> + +// result_of<Fn(ArgTypes...)> + +#include <type_traits> +#include <memory> + +typedef bool (&PF1)(); +typedef short (*PF2)(long); + +struct S +{ + operator PF2() const; + double operator()(char, int&); + void calc(long) const; + char data_; +}; + +typedef void (S::*PMS)(long) const; +typedef char S::*PMD; + +int main() +{ + static_assert((std::is_same<std::result_of<S(int)>::type, short>::value), "Error!"); + static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!"); + static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!"); +// static_assert(std::is_same<std::result_of<PMS(std::unique_ptr<S>, int)>::type, void>::value, "Error!"); +// static_assert(std::is_same<std::result_of<PMD(S)>::type, char&&>::value, "Error!"); +// static_assert(std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value, "Error!"); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp index 128ca05adff..ba2b2bac724 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -1 +1,19 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// underlying_type
#include <type_traits>
int main()
{
#error underlying_type is not implemented
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// underlying_type + +#include <type_traits> + +int main() +{ +#error underlying_type is not implemented +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp index ad43c439916..d601e85c184 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp @@ -1 +1,31 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_pointer
#include <type_traits>
template <class T, class U>
void test_add_pointer()
{
static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
}
int main()
{
test_add_pointer<void, void*>();
test_add_pointer<int, int*>();
test_add_pointer<int[3], int(*)[3]>();
test_add_pointer<int&, int*>();
test_add_pointer<const int&, const int*>();
test_add_pointer<int*, int**>();
test_add_pointer<const int*, const int**>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_pointer + +#include <type_traits> + +template <class T, class U> +void test_add_pointer() +{ + static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), ""); +} + +int main() +{ + test_add_pointer<void, void*>(); + test_add_pointer<int, int*>(); + test_add_pointer<int[3], int(*)[3]>(); + test_add_pointer<int&, int*>(); + test_add_pointer<const int&, const int*>(); + test_add_pointer<int*, int**>(); + test_add_pointer<const int*, const int**>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp index 4b1b903e5cd..5156afc714b 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_pointer
#include <type_traits>
template <class T, class U>
void test_remove_pointer()
{
static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), "");
}
int main()
{
test_remove_pointer<void, void>();
test_remove_pointer<int, int>();
test_remove_pointer<int[3], int[3]>();
test_remove_pointer<int*, int>();
test_remove_pointer<const int*, const int>();
test_remove_pointer<int**, int*>();
test_remove_pointer<int** const, int*>();
test_remove_pointer<int*const * , int* const>();
test_remove_pointer<const int** , const int*>();
test_remove_pointer<int&, int&>();
test_remove_pointer<const int&, const int&>();
test_remove_pointer<int(&)[3], int(&)[3]>();
test_remove_pointer<int(*)[3], int[3]>();
test_remove_pointer<int*&, int*&>();
test_remove_pointer<const int*&, const int*&>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_pointer + +#include <type_traits> + +template <class T, class U> +void test_remove_pointer() +{ + static_assert((std::is_same<typename std::remove_pointer<T>::type, U>::value), ""); +} + +int main() +{ + test_remove_pointer<void, void>(); + test_remove_pointer<int, int>(); + test_remove_pointer<int[3], int[3]>(); + test_remove_pointer<int*, int>(); + test_remove_pointer<const int*, const int>(); + test_remove_pointer<int**, int*>(); + test_remove_pointer<int** const, int*>(); + test_remove_pointer<int*const * , int* const>(); + test_remove_pointer<const int** , const int*>(); + + test_remove_pointer<int&, int&>(); + test_remove_pointer<const int&, const int&>(); + test_remove_pointer<int(&)[3], int(&)[3]>(); + test_remove_pointer<int(*)[3], int[3]>(); + test_remove_pointer<int*&, int*&>(); + test_remove_pointer<const int*&, const int*&>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp index 5dfea669906..3bb92fc81e1 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp @@ -1 +1,31 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_lvalue_reference
#include <type_traits>
template <class T, class U>
void test_add_lvalue_reference()
{
static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), "");
}
int main()
{
test_add_lvalue_reference<void, void>();
test_add_lvalue_reference<int, int&>();
test_add_lvalue_reference<int[3], int(&)[3]>();
test_add_lvalue_reference<int&, int&>();
test_add_lvalue_reference<const int&, const int&>();
test_add_lvalue_reference<int*, int*&>();
test_add_lvalue_reference<const int*, const int*&>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_lvalue_reference + +#include <type_traits> + +template <class T, class U> +void test_add_lvalue_reference() +{ + static_assert((std::is_same<typename std::add_lvalue_reference<T>::type, U>::value), ""); +} + +int main() +{ + test_add_lvalue_reference<void, void>(); + test_add_lvalue_reference<int, int&>(); + test_add_lvalue_reference<int[3], int(&)[3]>(); + test_add_lvalue_reference<int&, int&>(); + test_add_lvalue_reference<const int&, const int&>(); + test_add_lvalue_reference<int*, int*&>(); + test_add_lvalue_reference<const int*, const int*&>(); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp index 0a86b53e5e1..cbfb7f4d75c 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp @@ -1 +1,37 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// add_rvalue_reference
#include <type_traits>
#ifdef _LIBCPP_MOVE
template <class T, class U>
void test_add_rvalue_reference()
{
static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
}
#endif
int main()
{
#ifdef _LIBCPP_MOVE
test_add_rvalue_reference<void, void>();
test_add_rvalue_reference<int, int&&>();
test_add_rvalue_reference<int[3], int(&&)[3]>();
test_add_rvalue_reference<int&, int&>();
test_add_rvalue_reference<const int&, const int&>();
test_add_rvalue_reference<int*, int*&&>();
test_add_rvalue_reference<const int*, const int*&&>();
#endif
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_rvalue_reference + +#include <type_traits> + +#ifdef _LIBCPP_MOVE + +template <class T, class U> +void test_add_rvalue_reference() +{ + static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), ""); +} + +#endif // _LIBCPP_MOVE + +int main() +{ +#ifdef _LIBCPP_MOVE + test_add_rvalue_reference<void, void>(); + test_add_rvalue_reference<int, int&&>(); + test_add_rvalue_reference<int[3], int(&&)[3]>(); + test_add_rvalue_reference<int&, int&>(); + test_add_rvalue_reference<const int&, const int&>(); + test_add_rvalue_reference<int*, int*&&>(); + test_add_rvalue_reference<const int*, const int*&&>(); +#endif // _LIBCPP_MOVE +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp index d36dd019b07..b42b0b504a3 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp @@ -1 +1,43 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_reference
#include <type_traits>
template <class T, class U>
void test_remove_reference()
{
static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
}
int main()
{
test_remove_reference<void, void>();
test_remove_reference<int, int>();
test_remove_reference<int[3], int[3]>();
test_remove_reference<int*, int*>();
test_remove_reference<const int*, const int*>();
test_remove_reference<int&, int>();
test_remove_reference<const int&, const int>();
test_remove_reference<int(&)[3], int[3]>();
test_remove_reference<int*&, int*>();
test_remove_reference<const int*&, const int*>();
#ifdef _LIBCPP_MOVE
test_remove_reference<int&&, int>();
test_remove_reference<const int&&, const int>();
test_remove_reference<int(&&)[3], int[3]>();
test_remove_reference<int*&&, int*>();
test_remove_reference<const int*&&, const int*>();
#endif
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_reference + +#include <type_traits> + +template <class T, class U> +void test_remove_reference() +{ + static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), ""); +} + +int main() +{ + test_remove_reference<void, void>(); + test_remove_reference<int, int>(); + test_remove_reference<int[3], int[3]>(); + test_remove_reference<int*, int*>(); + test_remove_reference<const int*, const int*>(); + + test_remove_reference<int&, int>(); + test_remove_reference<const int&, const int>(); + test_remove_reference<int(&)[3], int[3]>(); + test_remove_reference<int*&, int*>(); + test_remove_reference<const int*&, const int*>(); + +#ifdef _LIBCPP_MOVE + test_remove_reference<int&&, int>(); + test_remove_reference<const int&&, const int>(); + test_remove_reference<int(&&)[3], int[3]>(); + test_remove_reference<int*&&, int*>(); + test_remove_reference<const int*&&, const int*>(); +#endif // _LIBCPP_MOVE +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp index 3b87a835512..5d369daea49 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp @@ -1 +1,42 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// make_signed
#include <type_traits>
enum Enum {zero, one_};
enum BigEnum
{
bzero,
big = 0xFFFFFFFFFFFFFFFFULL
};
int main()
{
static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), "");
static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), "");
static_assert((std::is_same<std::make_signed<int>::type, signed int>::value), "");
static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), "");
static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<BigEnum>::type,
std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// make_signed + +#include <type_traits> + +enum Enum {zero, one_}; + +enum BigEnum +{ + bzero, + big = 0xFFFFFFFFFFFFFFFFULL +}; + +int main() +{ + static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), ""); + static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), ""); + static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), ""); + static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), ""); + static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), ""); + static_assert((std::is_same<std::make_signed<int>::type, signed int>::value), ""); + static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), ""); + static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), ""); + static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), ""); + static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), ""); + static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), ""); + static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), ""); + static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), ""); + static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), ""); + static_assert((std::is_same<std::make_signed<BigEnum>::type, + std::conditional<sizeof(long) == 4, long long, long>::type>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp index d8bb4e33ef7..a029acb83ec 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp @@ -1 +1,42 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// make_unsigned
#include <type_traits>
enum Enum {zero, one_};
enum BigEnum
{
bzero,
big = 0xFFFFFFFFFFFFFFFFULL
};
int main()
{
static_assert((std::is_same<std::make_unsigned<signed char>::type, unsigned char>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned char>::type, unsigned char>::value), "");
static_assert((std::is_same<std::make_unsigned<char>::type, unsigned char>::value), "");
static_assert((std::is_same<std::make_unsigned<short>::type, unsigned short>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned short>::type, unsigned short>::value), "");
static_assert((std::is_same<std::make_unsigned<int>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned int>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<long>::type, unsigned long>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned long>::type, unsigned long>::value), "");
static_assert((std::is_same<std::make_unsigned<long long>::type, unsigned long long>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned long long>::type, unsigned long long>::value), "");
static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<const Enum>::type, const unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<BigEnum>::type,
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type>::value), "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// make_unsigned + +#include <type_traits> + +enum Enum {zero, one_}; + +enum BigEnum +{ + bzero, + big = 0xFFFFFFFFFFFFFFFFULL +}; + +int main() +{ + static_assert((std::is_same<std::make_unsigned<signed char>::type, unsigned char>::value), ""); + static_assert((std::is_same<std::make_unsigned<unsigned char>::type, unsigned char>::value), ""); + static_assert((std::is_same<std::make_unsigned<char>::type, unsigned char>::value), ""); + static_assert((std::is_same<std::make_unsigned<short>::type, unsigned short>::value), ""); + static_assert((std::is_same<std::make_unsigned<unsigned short>::type, unsigned short>::value), ""); + static_assert((std::is_same<std::make_unsigned<int>::type, unsigned int>::value), ""); + static_assert((std::is_same<std::make_unsigned<unsigned int>::type, unsigned int>::value), ""); + static_assert((std::is_same<std::make_unsigned<long>::type, unsigned long>::value), ""); + static_assert((std::is_same<std::make_unsigned<unsigned long>::type, unsigned long>::value), ""); + static_assert((std::is_same<std::make_unsigned<long long>::type, unsigned long long>::value), ""); + static_assert((std::is_same<std::make_unsigned<unsigned long long>::type, unsigned long long>::value), ""); + static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned int>::value), ""); + static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned int>::value), ""); + static_assert((std::is_same<std::make_unsigned<const Enum>::type, const unsigned int>::value), ""); + static_assert((std::is_same<std::make_unsigned<BigEnum>::type, + std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type>::value), ""); +} diff --git a/libcxx/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp b/libcxx/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp index e8db90cbee0..b89f168e9c4 100644 --- a/libcxx/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp @@ -1 +1,12 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp b/libcxx/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp index e8db90cbee0..b89f168e9c4 100644 --- a/libcxx/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp +++ b/libcxx/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp @@ -1 +1,12 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp index da1a68137d1..3eb16c215d5 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// array
#include <type_traits>
template <class T>
void test_array_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert( std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_array()
{
test_array_imp<T>();
test_array_imp<const T>();
test_array_imp<volatile T>();
test_array_imp<const volatile T>();
}
typedef char array[3];
typedef const char const_array[3];
typedef char incomplete_array[];
int main()
{
test_array<array>();
test_array<const_array>();
test_array<incomplete_array>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// array + +#include <type_traits> + +template <class T> +void test_array_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert( std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_array() +{ + test_array_imp<T>(); + test_array_imp<const T>(); + test_array_imp<volatile T>(); + test_array_imp<const volatile T>(); +} + +typedef char array[3]; +typedef const char const_array[3]; +typedef char incomplete_array[]; + +int main() +{ + test_array<array>(); + test_array<const_array>(); + test_array<incomplete_array>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp index fa604cf182e..3e6a9c08696 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// class
#include <type_traits>
template <class T>
void test_class_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert( std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_class()
{
test_class_imp<T>();
test_class_imp<const T>();
test_class_imp<volatile T>();
test_class_imp<const volatile T>();
}
class Class
{
int _;
double __;
};
int main()
{
test_class<Class>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// class + +#include <type_traits> + +template <class T> +void test_class_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert( std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_class() +{ + test_class_imp<T>(); + test_class_imp<const T>(); + test_class_imp<volatile T>(); + test_class_imp<const volatile T>(); +} + +class Class +{ + int _; + double __; +}; + +int main() +{ + test_class<Class>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp index b1a72f9f130..bdff0419fa8 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp @@ -1 +1,48 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enum
#include <type_traits>
template <class T>
void test_enum_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert( std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_enum()
{
test_enum_imp<T>();
test_enum_imp<const T>();
test_enum_imp<volatile T>();
test_enum_imp<const volatile T>();
}
enum Enum {zero, one};
int main()
{
test_enum<Enum>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enum + +#include <type_traits> + +template <class T> +void test_enum_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert( std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_enum() +{ + test_enum_imp<T>(); + test_enum_imp<const T>(); + test_enum_imp<volatile T>(); + test_enum_imp<const volatile T>(); +} + +enum Enum {zero, one}; + +int main() +{ + test_enum<Enum>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp index bd5d03f449d..efff10aa52c 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp @@ -1 +1,48 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// floating_point
#include <type_traits>
template <class T>
void test_floating_point_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert( std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_floating_point()
{
test_floating_point_imp<T>();
test_floating_point_imp<const T>();
test_floating_point_imp<volatile T>();
test_floating_point_imp<const volatile T>();
}
int main()
{
test_floating_point<float>();
test_floating_point<double>();
test_floating_point<long double>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// floating_point + +#include <type_traits> + +template <class T> +void test_floating_point_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert( std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_floating_point() +{ + test_floating_point_imp<T>(); + test_floating_point_imp<const T>(); + test_floating_point_imp<volatile T>(); + test_floating_point_imp<const volatile T>(); +} + +int main() +{ + test_floating_point<float>(); + test_floating_point<double>(); + test_floating_point<long double>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp index a3bab5b325a..ba5f5213f14 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp @@ -1 +1,49 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// function
#include <type_traits>
template <class T>
void test_function_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert( std::is_function<T>::value, "");
}
template <class T>
void test_function()
{
test_function_imp<T>();
test_function_imp<const T>();
test_function_imp<volatile T>();
test_function_imp<const volatile T>();
}
int main()
{
test_function<void ()>();
test_function<void (int)>();
test_function<int (double)>();
test_function<int (double, char)>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// function + +#include <type_traits> + +template <class T> +void test_function_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert( std::is_function<T>::value, ""); +} + +template <class T> +void test_function() +{ + test_function_imp<T>(); + test_function_imp<const T>(); + test_function_imp<volatile T>(); + test_function_imp<const volatile T>(); +} + +int main() +{ + test_function<void ()>(); + test_function<void (int)>(); + test_function<int (double)>(); + test_function<int (double, char)>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp index a4c0cb427cf..ac300466729 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp @@ -1 +1,58 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// integral
#include <type_traits>
template <class T>
void test_integral_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert( std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_integral()
{
test_integral_imp<T>();
test_integral_imp<const T>();
test_integral_imp<volatile T>();
test_integral_imp<const volatile T>();
}
int main()
{
test_integral<bool>();
test_integral<char>();
test_integral<signed char>();
test_integral<unsigned char>();
test_integral<wchar_t>();
test_integral<short>();
test_integral<unsigned short>();
test_integral<int>();
test_integral<unsigned int>();
test_integral<long>();
test_integral<unsigned long>();
test_integral<long long>();
test_integral<unsigned long long>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// integral + +#include <type_traits> + +template <class T> +void test_integral_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert( std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_integral() +{ + test_integral_imp<T>(); + test_integral_imp<const T>(); + test_integral_imp<volatile T>(); + test_integral_imp<const volatile T>(); +} + +int main() +{ + test_integral<bool>(); + test_integral<char>(); + test_integral<signed char>(); + test_integral<unsigned char>(); + test_integral<wchar_t>(); + test_integral<short>(); + test_integral<unsigned short>(); + test_integral<int>(); + test_integral<unsigned int>(); + test_integral<long>(); + test_integral<unsigned long>(); + test_integral<long long>(); + test_integral<unsigned long long>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp index 581a8aeb1c3..4b4dc2ed196 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp @@ -1 +1,38 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// lvalue_ref
#include <type_traits>
template <class T>
void test_lvalue_ref()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert( std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
int main()
{
test_lvalue_ref<int&>();
test_lvalue_ref<const int&>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// lvalue_ref + +#include <type_traits> + +template <class T> +void test_lvalue_ref() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert( std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +int main() +{ + test_lvalue_ref<int&>(); + test_lvalue_ref<const int&>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp index 2a66fa0a967..914697400a9 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_function_pointer
#include <type_traits>
template <class T>
void test_member_function_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert( std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_member_function_pointer()
{
test_member_function_pointer_imp<T>();
test_member_function_pointer_imp<const T>();
test_member_function_pointer_imp<volatile T>();
test_member_function_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_function_pointer<void (Class::*)()>();
test_member_function_pointer<void (Class::*)(int)>();
test_member_function_pointer<void (Class::*)(int, char)>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_function_pointer + +#include <type_traits> + +template <class T> +void test_member_function_pointer_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert( std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_member_function_pointer() +{ + test_member_function_pointer_imp<T>(); + test_member_function_pointer_imp<const T>(); + test_member_function_pointer_imp<volatile T>(); + test_member_function_pointer_imp<const volatile T>(); +} + +class Class +{ +}; + +int main() +{ + test_member_function_pointer<void (Class::*)()>(); + test_member_function_pointer<void (Class::*)(int)>(); + test_member_function_pointer<void (Class::*)(int, char)>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp index ed9eff866af..a768e9ec3cf 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp @@ -1 +1,50 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_object_pointer
#include <type_traits>
template <class T>
void test_member_object_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert( std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_member_object_pointer()
{
test_member_object_pointer_imp<T>();
test_member_object_pointer_imp<const T>();
test_member_object_pointer_imp<volatile T>();
test_member_object_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_object_pointer<int Class::*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_object_pointer + +#include <type_traits> + +template <class T> +void test_member_object_pointer_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert( std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_member_object_pointer() +{ + test_member_object_pointer_imp<T>(); + test_member_object_pointer_imp<const T>(); + test_member_object_pointer_imp<volatile T>(); + test_member_object_pointer_imp<const volatile T>(); +} + +class Class +{ +}; + +int main() +{ + test_member_object_pointer<int Class::*>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp index 263e7388689..c74e9ea4314 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp @@ -1 +1,49 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// pointer
#include <type_traits>
template <class T>
void test_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert( std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_pointer()
{
test_pointer_imp<T>();
test_pointer_imp<const T>();
test_pointer_imp<volatile T>();
test_pointer_imp<const volatile T>();
}
int main()
{
test_pointer<void*>();
test_pointer<int*>();
test_pointer<const int*>();
test_pointer<void (*)(int)>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// pointer + +#include <type_traits> + +template <class T> +void test_pointer_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert( std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_pointer() +{ + test_pointer_imp<T>(); + test_pointer_imp<const T>(); + test_pointer_imp<volatile T>(); + test_pointer_imp<const volatile T>(); +} + +int main() +{ + test_pointer<void*>(); + test_pointer<int*>(); + test_pointer<const int*>(); + test_pointer<void (*)(int)>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp index 91d7a6e0954..11600217ad9 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// rvalue_ref
#include <type_traits>
template <class T>
void test_rvalue_ref()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert( std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
int main()
{
#ifdef _LIBCPP_MOVE
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
#endif
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// rvalue_ref + +#include <type_traits> + +template <class T> +void test_rvalue_ref() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert( std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +int main() +{ +#ifdef _LIBCPP_MOVE + test_rvalue_ref<int&&>(); + test_rvalue_ref<const int&&>(); +#endif // _LIBCPP_MOVE +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp index 07c9729ff83..b386a8ae9b1 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// union
#include <type_traits>
template <class T>
void test_union_imp()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert( std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_union()
{
test_union_imp<T>();
test_union_imp<const T>();
test_union_imp<volatile T>();
test_union_imp<const volatile T>();
}
union Union
{
int _;
double __;
};
int main()
{
test_union<Union>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// union + +#include <type_traits> + +template <class T> +void test_union_imp() +{ + static_assert(!std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert( std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_union() +{ + test_union_imp<T>(); + test_union_imp<const T>(); + test_union_imp<volatile T>(); + test_union_imp<const volatile T>(); +} + +union Union +{ + int _; + double __; +}; + +int main() +{ + test_union<Union>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp index cfcff70a923..49ecacced81 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp @@ -1 +1,46 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// void
#include <type_traits>
template <class T>
void test_void_imp()
{
static_assert( std::is_void<T>::value, "");
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_function_pointer<T>::value, "");
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_function<T>::value, "");
}
template <class T>
void test_void()
{
test_void_imp<T>();
test_void_imp<const T>();
test_void_imp<volatile T>();
test_void_imp<const volatile T>();
}
int main()
{
test_void<void>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// void + +#include <type_traits> + +template <class T> +void test_void_imp() +{ + static_assert( std::is_void<T>::value, ""); + static_assert(!std::is_integral<T>::value, ""); + static_assert(!std::is_floating_point<T>::value, ""); + static_assert(!std::is_array<T>::value, ""); + static_assert(!std::is_pointer<T>::value, ""); + static_assert(!std::is_lvalue_reference<T>::value, ""); + static_assert(!std::is_rvalue_reference<T>::value, ""); + static_assert(!std::is_member_object_pointer<T>::value, ""); + static_assert(!std::is_member_function_pointer<T>::value, ""); + static_assert(!std::is_enum<T>::value, ""); + static_assert(!std::is_union<T>::value, ""); + static_assert(!std::is_class<T>::value, ""); + static_assert(!std::is_function<T>::value, ""); +} + +template <class T> +void test_void() +{ + test_void_imp<T>(); + test_void_imp<const T>(); + test_void_imp<volatile T>(); + test_void_imp<const volatile T>(); +} + +int main() +{ + test_void<void>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp index e521e45977d..80034227d41 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp @@ -1 +1,46 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// array
#include <type_traits>
template <class T>
void test_array_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_array()
{
test_array_imp<T>();
test_array_imp<const T>();
test_array_imp<volatile T>();
test_array_imp<const volatile T>();
}
typedef char array[3];
typedef const char const_array[3];
typedef char incomplete_array[];
int main()
{
test_array<array>();
test_array<const_array>();
test_array<incomplete_array>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// array + +#include <type_traits> + +template <class T> +void test_array_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_array() +{ + test_array_imp<T>(); + test_array_imp<const T>(); + test_array_imp<volatile T>(); + test_array_imp<const volatile T>(); +} + +typedef char array[3]; +typedef const char const_array[3]; +typedef char incomplete_array[]; + +int main() +{ + test_array<array>(); + test_array<const_array>(); + test_array<incomplete_array>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp index 4ddf499d754..ca727b2dbf3 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp @@ -1 +1,46 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// class
#include <type_traits>
template <class T>
void test_class_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_class()
{
test_class_imp<T>();
test_class_imp<const T>();
test_class_imp<volatile T>();
test_class_imp<const volatile T>();
}
class Class
{
int _;
double __;
};
int main()
{
test_class<Class>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// class + +#include <type_traits> + +template <class T> +void test_class_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_class() +{ + test_class_imp<T>(); + test_class_imp<const T>(); + test_class_imp<volatile T>(); + test_class_imp<const volatile T>(); +} + +class Class +{ + int _; + double __; +}; + +int main() +{ + test_class<Class>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp index cdd87e84c7e..9f0940db90b 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp @@ -1 +1,42 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// enum
#include <type_traits>
template <class T>
void test_enum_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_enum()
{
test_enum_imp<T>();
test_enum_imp<const T>();
test_enum_imp<volatile T>();
test_enum_imp<const volatile T>();
}
enum Enum {zero, one};
int main()
{
test_enum<Enum>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enum + +#include <type_traits> + +template <class T> +void test_enum_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert( std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_enum() +{ + test_enum_imp<T>(); + test_enum_imp<const T>(); + test_enum_imp<volatile T>(); + test_enum_imp<const volatile T>(); +} + +enum Enum {zero, one}; + +int main() +{ + test_enum<Enum>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp index d5d06eba72f..7d95a8a0dd1 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp @@ -1 +1,42 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// floating_point
#include <type_traits>
template <class T>
void test_floating_point_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert( std::is_arithmetic<T>::value, "");
static_assert( std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_floating_point()
{
test_floating_point_imp<T>();
test_floating_point_imp<const T>();
test_floating_point_imp<volatile T>();
test_floating_point_imp<const volatile T>();
}
int main()
{
test_floating_point<float>();
test_floating_point<double>();
test_floating_point<long double>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// floating_point + +#include <type_traits> + +template <class T> +void test_floating_point_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert( std::is_arithmetic<T>::value, ""); + static_assert( std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert( std::is_scalar<T>::value, ""); + static_assert(!std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_floating_point() +{ + test_floating_point_imp<T>(); + test_floating_point_imp<const T>(); + test_floating_point_imp<volatile T>(); + test_floating_point_imp<const volatile T>(); +} + +int main() +{ + test_floating_point<float>(); + test_floating_point<double>(); + test_floating_point<long double>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp index f67fd8f3606..b4c4386f909 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp @@ -1 +1,43 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// function
#include <type_traits>
template <class T>
void test_function_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_function()
{
test_function_imp<T>();
test_function_imp<const T>();
test_function_imp<volatile T>();
test_function_imp<const volatile T>();
}
int main()
{
test_function<void ()>();
test_function<void (int)>();
test_function<int (double)>();
test_function<int (double, char)>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// function + +#include <type_traits> + +template <class T> +void test_function_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert(!std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_function() +{ + test_function_imp<T>(); + test_function_imp<const T>(); + test_function_imp<volatile T>(); + test_function_imp<const volatile T>(); +} + +int main() +{ + test_function<void ()>(); + test_function<void (int)>(); + test_function<int (double)>(); + test_function<int (double, char)>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp index 12c72ee5a6a..fdf374b2315 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// integral
#include <type_traits>
template <class T>
void test_integral_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert( std::is_arithmetic<T>::value, "");
static_assert( std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_integral()
{
test_integral_imp<T>();
test_integral_imp<const T>();
test_integral_imp<volatile T>();
test_integral_imp<const volatile T>();
}
int main()
{
test_integral<bool>();
test_integral<char>();
test_integral<signed char>();
test_integral<unsigned char>();
test_integral<wchar_t>();
test_integral<short>();
test_integral<unsigned short>();
test_integral<int>();
test_integral<unsigned int>();
test_integral<long>();
test_integral<unsigned long>();
test_integral<long long>();
test_integral<unsigned long long>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// integral + +#include <type_traits> + +template <class T> +void test_integral_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert( std::is_arithmetic<T>::value, ""); + static_assert( std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert( std::is_scalar<T>::value, ""); + static_assert(!std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_integral() +{ + test_integral_imp<T>(); + test_integral_imp<const T>(); + test_integral_imp<volatile T>(); + test_integral_imp<const volatile T>(); +} + +int main() +{ + test_integral<bool>(); + test_integral<char>(); + test_integral<signed char>(); + test_integral<unsigned char>(); + test_integral<wchar_t>(); + test_integral<short>(); + test_integral<unsigned short>(); + test_integral<int>(); + test_integral<unsigned int>(); + test_integral<long>(); + test_integral<unsigned long>(); + test_integral<long long>(); + test_integral<unsigned long long>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp index db749b0e8b8..8a4fdb7df08 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp @@ -1 +1,32 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// lvalue_ref
#include <type_traits>
template <class T>
void test_lvalue_ref()
{
static_assert( std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
int main()
{
test_lvalue_ref<int&>();
test_lvalue_ref<const int&>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// lvalue_ref + +#include <type_traits> + +template <class T> +void test_lvalue_ref() +{ + static_assert( std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert(!std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +int main() +{ + test_lvalue_ref<int&>(); + test_lvalue_ref<const int&>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp index 9e8f15973f0..05c79be84ab 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp @@ -1 +1,46 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_function_pointer
#include <type_traits>
template <class T>
void test_member_function_pointer_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert( std::is_member_pointer<T>::value, "");
}
template <class T>
void test_member_function_pointer()
{
test_member_function_pointer_imp<T>();
test_member_function_pointer_imp<const T>();
test_member_function_pointer_imp<volatile T>();
test_member_function_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_function_pointer<void (Class::*)()>();
test_member_function_pointer<void (Class::*)(int)>();
test_member_function_pointer<void (Class::*)(int, char)>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_function_pointer + +#include <type_traits> + +template <class T> +void test_member_function_pointer_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert( std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert( std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_member_function_pointer() +{ + test_member_function_pointer_imp<T>(); + test_member_function_pointer_imp<const T>(); + test_member_function_pointer_imp<volatile T>(); + test_member_function_pointer_imp<const volatile T>(); +} + +class Class +{ +}; + +int main() +{ + test_member_function_pointer<void (Class::*)()>(); + test_member_function_pointer<void (Class::*)(int)>(); + test_member_function_pointer<void (Class::*)(int, char)>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp index 6af0606f02e..2ac24438258 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp @@ -1 +1,44 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// member_object_pointer
#include <type_traits>
template <class T>
void test_member_object_pointer_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert( std::is_member_pointer<T>::value, "");
}
template <class T>
void test_member_object_pointer()
{
test_member_object_pointer_imp<T>();
test_member_object_pointer_imp<const T>();
test_member_object_pointer_imp<volatile T>();
test_member_object_pointer_imp<const volatile T>();
}
class Class
{
};
int main()
{
test_member_object_pointer<int Class::*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_object_pointer + +#include <type_traits> + +template <class T> +void test_member_object_pointer_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert( std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert( std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_member_object_pointer() +{ + test_member_object_pointer_imp<T>(); + test_member_object_pointer_imp<const T>(); + test_member_object_pointer_imp<volatile T>(); + test_member_object_pointer_imp<const volatile T>(); +} + +class Class +{ +}; + +int main() +{ + test_member_object_pointer<int Class::*>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp index ccc936b13ce..4cc5ccf998c 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp @@ -1 +1,43 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// pointer
#include <type_traits>
template <class T>
void test_pointer_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_pointer()
{
test_pointer_imp<T>();
test_pointer_imp<const T>();
test_pointer_imp<volatile T>();
test_pointer_imp<const volatile T>();
}
int main()
{
test_pointer<void*>();
test_pointer<int*>();
test_pointer<const int*>();
test_pointer<void (*)(int)>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// pointer + +#include <type_traits> + +template <class T> +void test_pointer_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert( std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_pointer() +{ + test_pointer_imp<T>(); + test_pointer_imp<const T>(); + test_pointer_imp<volatile T>(); + test_pointer_imp<const volatile T>(); +} + +int main() +{ + test_pointer<void*>(); + test_pointer<int*>(); + test_pointer<const int*>(); + test_pointer<void (*)(int)>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp index 7233ba99f3f..62f99781549 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp @@ -1 +1,34 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// rvalue_ref
#include <type_traits>
template <class T>
void test_rvalue_ref()
{
static_assert(std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
int main()
{
#ifdef _LIBCPP_MOVE
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
#endif
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// rvalue_ref + +#include <type_traits> + +template <class T> +void test_rvalue_ref() +{ + static_assert(std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert(!std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +int main() +{ +#ifdef _LIBCPP_MOVE + test_rvalue_ref<int&&>(); + test_rvalue_ref<const int&&>(); +#endif // _LIBCPP_MOVE +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp index 8eb85706490..eeb073e963b 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp @@ -1 +1,46 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// union
#include <type_traits>
template <class T>
void test_union_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_fundamental<T>::value, "");
static_assert( std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert( std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_union()
{
test_union_imp<T>();
test_union_imp<const T>();
test_union_imp<volatile T>();
test_union_imp<const volatile T>();
}
union Union
{
int _;
double __;
};
int main()
{
test_union<Union>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// union + +#include <type_traits> + +template <class T> +void test_union_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert(!std::is_fundamental<T>::value, ""); + static_assert( std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert( std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_union() +{ + test_union_imp<T>(); + test_union_imp<const T>(); + test_union_imp<volatile T>(); + test_union_imp<const volatile T>(); +} + +union Union +{ + int _; + double __; +}; + +int main() +{ + test_union<Union>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp index 88c2fa8a0e7..9bebfba6dbe 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// void
#include <type_traits>
template <class T>
void test_void_imp()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_arithmetic<T>::value, "");
static_assert( std::is_fundamental<T>::value, "");
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_scalar<T>::value, "");
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_member_pointer<T>::value, "");
}
template <class T>
void test_void()
{
test_void_imp<T>();
test_void_imp<const T>();
test_void_imp<volatile T>();
test_void_imp<const volatile T>();
}
int main()
{
test_void<void>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// void + +#include <type_traits> + +template <class T> +void test_void_imp() +{ + static_assert(!std::is_reference<T>::value, ""); + static_assert(!std::is_arithmetic<T>::value, ""); + static_assert( std::is_fundamental<T>::value, ""); + static_assert(!std::is_object<T>::value, ""); + static_assert(!std::is_scalar<T>::value, ""); + static_assert(!std::is_compound<T>::value, ""); + static_assert(!std::is_member_pointer<T>::value, ""); +} + +template <class T> +void test_void() +{ + test_void_imp<T>(); + test_void_imp<const T>(); + test_void_imp<volatile T>(); + test_void_imp<const volatile T>(); +} + +int main() +{ + test_void<void>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp index 093ca33c98d..a277a3468fd 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp @@ -1 +1,42 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// alignment_of
#include <type_traits>
template <class T, unsigned A>
void test_alignment_of()
{
static_assert( std::alignment_of<T>::value == A, "");
static_assert( std::alignment_of<const T>::value == A, "");
static_assert( std::alignment_of<volatile T>::value == A, "");
static_assert( std::alignment_of<const volatile T>::value == A, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_alignment_of<int&, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<Class, 1>();
test_alignment_of<int*, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<const int*, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<char[3], 1>();
test_alignment_of<int, 4>();
test_alignment_of<double, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<bool, 1>();
test_alignment_of<unsigned, 4>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// alignment_of + +#include <type_traits> + +template <class T, unsigned A> +void test_alignment_of() +{ + static_assert( std::alignment_of<T>::value == A, ""); + static_assert( std::alignment_of<const T>::value == A, ""); + static_assert( std::alignment_of<volatile T>::value == A, ""); + static_assert( std::alignment_of<const volatile T>::value == A, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_alignment_of<int&, sizeof(long) == 4 ? 4 : 8>(); + test_alignment_of<Class, 1>(); + test_alignment_of<int*, sizeof(long) == 4 ? 4 : 8>(); + test_alignment_of<const int*, sizeof(long) == 4 ? 4 : 8>(); + test_alignment_of<char[3], 1>(); + test_alignment_of<int, 4>(); + test_alignment_of<double, sizeof(long) == 4 ? 4 : 8>(); + test_alignment_of<bool, 1>(); + test_alignment_of<unsigned, 4>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp index d149eb3d9d3..105217c21c3 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp @@ -1 +1,60 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// extent
#include <type_traits>
template <class T, unsigned A>
void test_extent()
{
static_assert((std::extent<T>::value == A), "");
static_assert((std::extent<const T>::value == A), "");
static_assert((std::extent<volatile T>::value == A), "");
static_assert((std::extent<const volatile T>::value == A), "");
}
template <class T, unsigned A>
void test_extent1()
{
static_assert((std::extent<T, 1>::value == A), "");
static_assert((std::extent<const T, 1>::value == A), "");
static_assert((std::extent<volatile T, 1>::value == A), "");
static_assert((std::extent<const volatile T, 1>::value == A), "");
}
class Class
{
public:
~Class();
};
int main()
{
test_extent<void, 0>();
test_extent<int&, 0>();
test_extent<Class, 0>();
test_extent<int*, 0>();
test_extent<const int*, 0>();
test_extent<int, 0>();
test_extent<double, 0>();
test_extent<bool, 0>();
test_extent<unsigned, 0>();
test_extent<int[2], 2>();
test_extent<int[2][4], 2>();
test_extent<int[][4], 0>();
test_extent1<int, 0>();
test_extent1<int[2], 0>();
test_extent1<int[2][4], 4>();
test_extent1<int[][4], 4>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// extent + +#include <type_traits> + +template <class T, unsigned A> +void test_extent() +{ + static_assert((std::extent<T>::value == A), ""); + static_assert((std::extent<const T>::value == A), ""); + static_assert((std::extent<volatile T>::value == A), ""); + static_assert((std::extent<const volatile T>::value == A), ""); +} + +template <class T, unsigned A> +void test_extent1() +{ + static_assert((std::extent<T, 1>::value == A), ""); + static_assert((std::extent<const T, 1>::value == A), ""); + static_assert((std::extent<volatile T, 1>::value == A), ""); + static_assert((std::extent<const volatile T, 1>::value == A), ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_extent<void, 0>(); + test_extent<int&, 0>(); + test_extent<Class, 0>(); + test_extent<int*, 0>(); + test_extent<const int*, 0>(); + test_extent<int, 0>(); + test_extent<double, 0>(); + test_extent<bool, 0>(); + test_extent<unsigned, 0>(); + + test_extent<int[2], 2>(); + test_extent<int[2][4], 2>(); + test_extent<int[][4], 0>(); + + test_extent1<int, 0>(); + test_extent1<int[2], 0>(); + test_extent1<int[2][4], 4>(); + test_extent1<int[][4], 4>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp index 31a5a7c1c1f..127e76290e0 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_nothrow_copy_assign
#include <type_traits>
template <class T>
void test_has_nothrow_assign()
{
static_assert( std::has_nothrow_copy_assign<T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
static_assert( std::has_nothrow_copy_assign<volatile T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
}
template <class T>
void test_has_not_nothrow_assign()
{
static_assert(!std::has_nothrow_copy_assign<T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
static_assert(!std::has_nothrow_copy_assign<volatile T>::value, "");
static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A& operator=(const A&);
};
int main()
{
test_has_not_nothrow_assign<void>();
test_has_not_nothrow_assign<A>();
test_has_not_nothrow_assign<int&>();
test_has_nothrow_assign<Union>();
test_has_nothrow_assign<Abstract>();
test_has_nothrow_assign<Empty>();
test_has_nothrow_assign<int>();
test_has_nothrow_assign<double>();
test_has_nothrow_assign<int*>();
test_has_nothrow_assign<const int*>();
test_has_nothrow_assign<char[3]>();
test_has_nothrow_assign<char[3]>();
test_has_nothrow_assign<NotEmpty>();
test_has_nothrow_assign<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_copy_assign + +#include <type_traits> + +template <class T> +void test_has_nothrow_assign() +{ + static_assert( std::has_nothrow_copy_assign<T>::value, ""); + static_assert(!std::has_nothrow_copy_assign<const T>::value, ""); + static_assert( std::has_nothrow_copy_assign<volatile T>::value, ""); + static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_assign() +{ + static_assert(!std::has_nothrow_copy_assign<T>::value, ""); + static_assert(!std::has_nothrow_copy_assign<const T>::value, ""); + static_assert(!std::has_nothrow_copy_assign<volatile T>::value, ""); + static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_not_nothrow_assign<void>(); + test_has_not_nothrow_assign<A>(); + test_has_not_nothrow_assign<int&>(); + + test_has_nothrow_assign<Union>(); + test_has_nothrow_assign<Abstract>(); + test_has_nothrow_assign<Empty>(); + test_has_nothrow_assign<int>(); + test_has_nothrow_assign<double>(); + test_has_nothrow_assign<int*>(); + test_has_nothrow_assign<const int*>(); + test_has_nothrow_assign<char[3]>(); + test_has_nothrow_assign<char[3]>(); + test_has_nothrow_assign<NotEmpty>(); + test_has_nothrow_assign<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp index 1a9beaa5d77..1634dea8b64 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_nothrow_copy_constructor
#include <type_traits>
template <class T>
void test_has_nothrow_copy_constructor()
{
static_assert( std::has_nothrow_copy_constructor<T>::value, "");
static_assert( std::has_nothrow_copy_constructor<const T>::value, "");
static_assert( std::has_nothrow_copy_constructor<volatile T>::value, "");
static_assert( std::has_nothrow_copy_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_nothrow_copy_constructor()
{
static_assert(!std::has_nothrow_copy_constructor<T>::value, "");
static_assert(!std::has_nothrow_copy_constructor<const T>::value, "");
static_assert(!std::has_nothrow_copy_constructor<volatile T>::value, "");
static_assert(!std::has_nothrow_copy_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A(const A&);
};
int main()
{
test_has_not_nothrow_copy_constructor<void>();
test_has_not_nothrow_copy_constructor<A>();
test_has_not_nothrow_copy_constructor<int&>();
test_has_nothrow_copy_constructor<Union>();
test_has_nothrow_copy_constructor<Abstract>();
test_has_nothrow_copy_constructor<Empty>();
test_has_nothrow_copy_constructor<int>();
test_has_nothrow_copy_constructor<double>();
test_has_nothrow_copy_constructor<int*>();
test_has_nothrow_copy_constructor<const int*>();
test_has_nothrow_copy_constructor<char[3]>();
test_has_nothrow_copy_constructor<char[3]>();
test_has_nothrow_copy_constructor<NotEmpty>();
test_has_nothrow_copy_constructor<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_copy_constructor + +#include <type_traits> + +template <class T> +void test_has_nothrow_copy_constructor() +{ + static_assert( std::has_nothrow_copy_constructor<T>::value, ""); + static_assert( std::has_nothrow_copy_constructor<const T>::value, ""); + static_assert( std::has_nothrow_copy_constructor<volatile T>::value, ""); + static_assert( std::has_nothrow_copy_constructor<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_copy_constructor() +{ + static_assert(!std::has_nothrow_copy_constructor<T>::value, ""); + static_assert(!std::has_nothrow_copy_constructor<const T>::value, ""); + static_assert(!std::has_nothrow_copy_constructor<volatile T>::value, ""); + static_assert(!std::has_nothrow_copy_constructor<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_copy_constructor<void>(); + test_has_not_nothrow_copy_constructor<A>(); + test_has_not_nothrow_copy_constructor<int&>(); + + test_has_nothrow_copy_constructor<Union>(); + test_has_nothrow_copy_constructor<Abstract>(); + test_has_nothrow_copy_constructor<Empty>(); + test_has_nothrow_copy_constructor<int>(); + test_has_nothrow_copy_constructor<double>(); + test_has_nothrow_copy_constructor<int*>(); + test_has_nothrow_copy_constructor<const int*>(); + test_has_nothrow_copy_constructor<char[3]>(); + test_has_nothrow_copy_constructor<char[3]>(); + test_has_nothrow_copy_constructor<NotEmpty>(); + test_has_nothrow_copy_constructor<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp index 2a4e81e5de4..cc4a4580930 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_nothrow_default_constructor
#include <type_traits>
template <class T>
void test_has_nothrow_default_constructor()
{
static_assert( std::has_nothrow_default_constructor<T>::value, "");
static_assert( std::has_nothrow_default_constructor<const T>::value, "");
static_assert( std::has_nothrow_default_constructor<volatile T>::value, "");
static_assert( std::has_nothrow_default_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_nothrow_default_constructor()
{
static_assert(!std::has_nothrow_default_constructor<T>::value, "");
static_assert(!std::has_nothrow_default_constructor<const T>::value, "");
static_assert(!std::has_nothrow_default_constructor<volatile T>::value, "");
static_assert(!std::has_nothrow_default_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A();
};
int main()
{
test_has_not_nothrow_default_constructor<void>();
test_has_not_nothrow_default_constructor<int&>();
test_has_not_nothrow_default_constructor<A>();
test_has_nothrow_default_constructor<Union>();
test_has_nothrow_default_constructor<Abstract>();
test_has_nothrow_default_constructor<Empty>();
test_has_nothrow_default_constructor<int>();
test_has_nothrow_default_constructor<double>();
test_has_nothrow_default_constructor<int*>();
test_has_nothrow_default_constructor<const int*>();
test_has_nothrow_default_constructor<char[3]>();
test_has_nothrow_default_constructor<char[3]>();
test_has_nothrow_default_constructor<NotEmpty>();
test_has_nothrow_default_constructor<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_default_constructor + +#include <type_traits> + +template <class T> +void test_has_nothrow_default_constructor() +{ + static_assert( std::has_nothrow_default_constructor<T>::value, ""); + static_assert( std::has_nothrow_default_constructor<const T>::value, ""); + static_assert( std::has_nothrow_default_constructor<volatile T>::value, ""); + static_assert( std::has_nothrow_default_constructor<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_nothrow_default_constructor() +{ + static_assert(!std::has_nothrow_default_constructor<T>::value, ""); + static_assert(!std::has_nothrow_default_constructor<const T>::value, ""); + static_assert(!std::has_nothrow_default_constructor<volatile T>::value, ""); + static_assert(!std::has_nothrow_default_constructor<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_nothrow_default_constructor<void>(); + test_has_not_nothrow_default_constructor<int&>(); + test_has_not_nothrow_default_constructor<A>(); + + test_has_nothrow_default_constructor<Union>(); + test_has_nothrow_default_constructor<Abstract>(); + test_has_nothrow_default_constructor<Empty>(); + test_has_nothrow_default_constructor<int>(); + test_has_nothrow_default_constructor<double>(); + test_has_nothrow_default_constructor<int*>(); + test_has_nothrow_default_constructor<const int*>(); + test_has_nothrow_default_constructor<char[3]>(); + test_has_nothrow_default_constructor<char[3]>(); + test_has_nothrow_default_constructor<NotEmpty>(); + test_has_nothrow_default_constructor<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp index 06419502736..762bd511479 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_copy_assign
#include <type_traits>
template <class T>
void test_has_trivial_assign()
{
static_assert( std::has_trivial_copy_assign<T>::value, "");
static_assert(!std::has_trivial_copy_assign<const T>::value, "");
static_assert( std::has_trivial_copy_assign<volatile T>::value, "");
static_assert(!std::has_trivial_copy_assign<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_assign()
{
static_assert(!std::has_trivial_copy_assign<T>::value, "");
static_assert(!std::has_trivial_copy_assign<const T>::value, "");
static_assert(!std::has_trivial_copy_assign<volatile T>::value, "");
static_assert(!std::has_trivial_copy_assign<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A& operator=(const A&);
};
int main()
{
test_has_not_trivial_assign<void>();
test_has_not_trivial_assign<A>();
test_has_not_trivial_assign<int&>();
test_has_trivial_assign<Union>();
test_has_trivial_assign<Abstract>();
test_has_trivial_assign<Empty>();
test_has_trivial_assign<int>();
test_has_trivial_assign<double>();
test_has_trivial_assign<int*>();
test_has_trivial_assign<const int*>();
test_has_trivial_assign<char[3]>();
test_has_trivial_assign<char[3]>();
test_has_trivial_assign<NotEmpty>();
test_has_trivial_assign<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_trivial_copy_assign + +#include <type_traits> + +template <class T> +void test_has_trivial_assign() +{ + static_assert( std::has_trivial_copy_assign<T>::value, ""); + static_assert(!std::has_trivial_copy_assign<const T>::value, ""); + static_assert( std::has_trivial_copy_assign<volatile T>::value, ""); + static_assert(!std::has_trivial_copy_assign<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_assign() +{ + static_assert(!std::has_trivial_copy_assign<T>::value, ""); + static_assert(!std::has_trivial_copy_assign<const T>::value, ""); + static_assert(!std::has_trivial_copy_assign<volatile T>::value, ""); + static_assert(!std::has_trivial_copy_assign<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_not_trivial_assign<void>(); + test_has_not_trivial_assign<A>(); + test_has_not_trivial_assign<int&>(); + + test_has_trivial_assign<Union>(); + test_has_trivial_assign<Abstract>(); + test_has_trivial_assign<Empty>(); + test_has_trivial_assign<int>(); + test_has_trivial_assign<double>(); + test_has_trivial_assign<int*>(); + test_has_trivial_assign<const int*>(); + test_has_trivial_assign<char[3]>(); + test_has_trivial_assign<char[3]>(); + test_has_trivial_assign<NotEmpty>(); + test_has_trivial_assign<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp index 711d9c3915a..c51b7726728 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_copy_constructor
#include <type_traits>
template <class T>
void test_has_trivial_copy_constructor()
{
static_assert( std::has_trivial_copy_constructor<T>::value, "");
static_assert( std::has_trivial_copy_constructor<const T>::value, "");
static_assert( std::has_trivial_copy_constructor<volatile T>::value, "");
static_assert( std::has_trivial_copy_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_copy_constructor()
{
static_assert(!std::has_trivial_copy_constructor<T>::value, "");
static_assert(!std::has_trivial_copy_constructor<const T>::value, "");
static_assert(!std::has_trivial_copy_constructor<volatile T>::value, "");
static_assert(!std::has_trivial_copy_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A(const A&);
};
int main()
{
test_has_not_trivial_copy_constructor<void>();
test_has_not_trivial_copy_constructor<A>();
test_has_not_trivial_copy_constructor<int&>();
test_has_trivial_copy_constructor<Union>();
test_has_trivial_copy_constructor<Abstract>();
test_has_trivial_copy_constructor<Empty>();
test_has_trivial_copy_constructor<int>();
test_has_trivial_copy_constructor<double>();
test_has_trivial_copy_constructor<int*>();
test_has_trivial_copy_constructor<const int*>();
test_has_trivial_copy_constructor<char[3]>();
test_has_trivial_copy_constructor<char[3]>();
test_has_trivial_copy_constructor<NotEmpty>();
test_has_trivial_copy_constructor<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_trivial_copy_constructor + +#include <type_traits> + +template <class T> +void test_has_trivial_copy_constructor() +{ + static_assert( std::has_trivial_copy_constructor<T>::value, ""); + static_assert( std::has_trivial_copy_constructor<const T>::value, ""); + static_assert( std::has_trivial_copy_constructor<volatile T>::value, ""); + static_assert( std::has_trivial_copy_constructor<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_copy_constructor() +{ + static_assert(!std::has_trivial_copy_constructor<T>::value, ""); + static_assert(!std::has_trivial_copy_constructor<const T>::value, ""); + static_assert(!std::has_trivial_copy_constructor<volatile T>::value, ""); + static_assert(!std::has_trivial_copy_constructor<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_trivial_copy_constructor<void>(); + test_has_not_trivial_copy_constructor<A>(); + test_has_not_trivial_copy_constructor<int&>(); + + test_has_trivial_copy_constructor<Union>(); + test_has_trivial_copy_constructor<Abstract>(); + test_has_trivial_copy_constructor<Empty>(); + test_has_trivial_copy_constructor<int>(); + test_has_trivial_copy_constructor<double>(); + test_has_trivial_copy_constructor<int*>(); + test_has_trivial_copy_constructor<const int*>(); + test_has_trivial_copy_constructor<char[3]>(); + test_has_trivial_copy_constructor<char[3]>(); + test_has_trivial_copy_constructor<NotEmpty>(); + test_has_trivial_copy_constructor<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp index 841fb37ec7c..cf20c8223f9 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_default_constructor
#include <type_traits>
template <class T>
void test_has_trivial_default_constructor()
{
static_assert( std::has_trivial_default_constructor<T>::value, "");
static_assert( std::has_trivial_default_constructor<const T>::value, "");
static_assert( std::has_trivial_default_constructor<volatile T>::value, "");
static_assert( std::has_trivial_default_constructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_default_constructor()
{
static_assert(!std::has_trivial_default_constructor<T>::value, "");
static_assert(!std::has_trivial_default_constructor<const T>::value, "");
static_assert(!std::has_trivial_default_constructor<volatile T>::value, "");
static_assert(!std::has_trivial_default_constructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A();
};
int main()
{
test_has_not_trivial_default_constructor<void>();
test_has_not_trivial_default_constructor<int&>();
test_has_not_trivial_default_constructor<A>();
test_has_trivial_default_constructor<Union>();
test_has_trivial_default_constructor<Abstract>();
test_has_trivial_default_constructor<Empty>();
test_has_trivial_default_constructor<int>();
test_has_trivial_default_constructor<double>();
test_has_trivial_default_constructor<int*>();
test_has_trivial_default_constructor<const int*>();
test_has_trivial_default_constructor<char[3]>();
test_has_trivial_default_constructor<char[3]>();
test_has_trivial_default_constructor<NotEmpty>();
test_has_trivial_default_constructor<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_trivial_default_constructor + +#include <type_traits> + +template <class T> +void test_has_trivial_default_constructor() +{ + static_assert( std::has_trivial_default_constructor<T>::value, ""); + static_assert( std::has_trivial_default_constructor<const T>::value, ""); + static_assert( std::has_trivial_default_constructor<volatile T>::value, ""); + static_assert( std::has_trivial_default_constructor<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_default_constructor() +{ + static_assert(!std::has_trivial_default_constructor<T>::value, ""); + static_assert(!std::has_trivial_default_constructor<const T>::value, ""); + static_assert(!std::has_trivial_default_constructor<volatile T>::value, ""); + static_assert(!std::has_trivial_default_constructor<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_trivial_default_constructor<void>(); + test_has_not_trivial_default_constructor<int&>(); + test_has_not_trivial_default_constructor<A>(); + + test_has_trivial_default_constructor<Union>(); + test_has_trivial_default_constructor<Abstract>(); + test_has_trivial_default_constructor<Empty>(); + test_has_trivial_default_constructor<int>(); + test_has_trivial_default_constructor<double>(); + test_has_trivial_default_constructor<int*>(); + test_has_trivial_default_constructor<const int*>(); + test_has_trivial_default_constructor<char[3]>(); + test_has_trivial_default_constructor<char[3]>(); + test_has_trivial_default_constructor<NotEmpty>(); + test_has_trivial_default_constructor<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp index b0b09d9c8a9..37c278cebc0 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_trivial_destructor
#include <type_traits>
template <class T>
void test_has_trivial_destructor()
{
static_assert( std::has_trivial_destructor<T>::value, "");
static_assert( std::has_trivial_destructor<const T>::value, "");
static_assert( std::has_trivial_destructor<volatile T>::value, "");
static_assert( std::has_trivial_destructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_trivial_destructor()
{
static_assert(!std::has_trivial_destructor<T>::value, "");
static_assert(!std::has_trivial_destructor<const T>::value, "");
static_assert(!std::has_trivial_destructor<volatile T>::value, "");
static_assert(!std::has_trivial_destructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
~A();
};
int main()
{
test_has_not_trivial_destructor<void>();
test_has_not_trivial_destructor<A>();
test_has_not_trivial_destructor<Abstract>();
test_has_not_trivial_destructor<NotEmpty>();
test_has_trivial_destructor<int&>();
test_has_trivial_destructor<Union>();
test_has_trivial_destructor<Empty>();
test_has_trivial_destructor<int>();
test_has_trivial_destructor<double>();
test_has_trivial_destructor<int*>();
test_has_trivial_destructor<const int*>();
test_has_trivial_destructor<char[3]>();
test_has_trivial_destructor<char[3]>();
test_has_trivial_destructor<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_trivial_destructor + +#include <type_traits> + +template <class T> +void test_has_trivial_destructor() +{ + static_assert( std::has_trivial_destructor<T>::value, ""); + static_assert( std::has_trivial_destructor<const T>::value, ""); + static_assert( std::has_trivial_destructor<volatile T>::value, ""); + static_assert( std::has_trivial_destructor<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_trivial_destructor() +{ + static_assert(!std::has_trivial_destructor<T>::value, ""); + static_assert(!std::has_trivial_destructor<const T>::value, ""); + static_assert(!std::has_trivial_destructor<volatile T>::value, ""); + static_assert(!std::has_trivial_destructor<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_trivial_destructor<void>(); + test_has_not_trivial_destructor<A>(); + test_has_not_trivial_destructor<Abstract>(); + test_has_not_trivial_destructor<NotEmpty>(); + + test_has_trivial_destructor<int&>(); + test_has_trivial_destructor<Union>(); + test_has_trivial_destructor<Empty>(); + test_has_trivial_destructor<int>(); + test_has_trivial_destructor<double>(); + test_has_trivial_destructor<int*>(); + test_has_trivial_destructor<const int*>(); + test_has_trivial_destructor<char[3]>(); + test_has_trivial_destructor<char[3]>(); + test_has_trivial_destructor<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp index 05198ba130d..a9b38960443 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp @@ -1 +1,77 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// has_virtual_destructor
#include <type_traits>
template <class T>
void test_has_virtual_destructor()
{
static_assert( std::has_virtual_destructor<T>::value, "");
static_assert( std::has_virtual_destructor<const T>::value, "");
static_assert( std::has_virtual_destructor<volatile T>::value, "");
static_assert( std::has_virtual_destructor<const volatile T>::value, "");
}
template <class T>
void test_has_not_virtual_destructor()
{
static_assert(!std::has_virtual_destructor<T>::value, "");
static_assert(!std::has_virtual_destructor<const T>::value, "");
static_assert(!std::has_virtual_destructor<volatile T>::value, "");
static_assert(!std::has_virtual_destructor<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
~A();
};
int main()
{
test_has_not_virtual_destructor<void>();
test_has_not_virtual_destructor<A>();
test_has_not_virtual_destructor<int&>();
test_has_not_virtual_destructor<Union>();
test_has_not_virtual_destructor<Empty>();
test_has_not_virtual_destructor<int>();
test_has_not_virtual_destructor<double>();
test_has_not_virtual_destructor<int*>();
test_has_not_virtual_destructor<const int*>();
test_has_not_virtual_destructor<char[3]>();
test_has_not_virtual_destructor<char[3]>();
test_has_not_virtual_destructor<bit_zero>();
test_has_virtual_destructor<Abstract>();
test_has_virtual_destructor<NotEmpty>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_virtual_destructor + +#include <type_traits> + +template <class T> +void test_has_virtual_destructor() +{ + static_assert( std::has_virtual_destructor<T>::value, ""); + static_assert( std::has_virtual_destructor<const T>::value, ""); + static_assert( std::has_virtual_destructor<volatile T>::value, ""); + static_assert( std::has_virtual_destructor<const volatile T>::value, ""); +} + +template <class T> +void test_has_not_virtual_destructor() +{ + static_assert(!std::has_virtual_destructor<T>::value, ""); + static_assert(!std::has_virtual_destructor<const T>::value, ""); + static_assert(!std::has_virtual_destructor<volatile T>::value, ""); + static_assert(!std::has_virtual_destructor<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_virtual_destructor<void>(); + test_has_not_virtual_destructor<A>(); + test_has_not_virtual_destructor<int&>(); + test_has_not_virtual_destructor<Union>(); + test_has_not_virtual_destructor<Empty>(); + test_has_not_virtual_destructor<int>(); + test_has_not_virtual_destructor<double>(); + test_has_not_virtual_destructor<int*>(); + test_has_not_virtual_destructor<const int*>(); + test_has_not_virtual_destructor<char[3]>(); + test_has_not_virtual_destructor<char[3]>(); + test_has_not_virtual_destructor<bit_zero>(); + + test_has_virtual_destructor<Abstract>(); + test_has_virtual_destructor<NotEmpty>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp index 583cbff8ffa..9be3d1dfe51 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp @@ -1 +1,71 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_abstract
#include <type_traits>
template <class T>
void test_is_abstract()
{
static_assert( std::is_abstract<T>::value, "");
static_assert( std::is_abstract<const T>::value, "");
static_assert( std::is_abstract<volatile T>::value, "");
static_assert( std::is_abstract<const volatile T>::value, "");
}
template <class T>
void test_is_not_abstract()
{
static_assert(!std::is_abstract<T>::value, "");
static_assert(!std::is_abstract<const T>::value, "");
static_assert(!std::is_abstract<volatile T>::value, "");
static_assert(!std::is_abstract<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
int main()
{
test_is_not_abstract<void>();
test_is_not_abstract<int&>();
test_is_not_abstract<int>();
test_is_not_abstract<double>();
test_is_not_abstract<int*>();
test_is_not_abstract<const int*>();
test_is_not_abstract<char[3]>();
test_is_not_abstract<char[3]>();
test_is_not_abstract<Union>();
test_is_not_abstract<Empty>();
test_is_not_abstract<bit_zero>();
test_is_not_abstract<NotEmpty>();
test_is_abstract<Abstract>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_abstract + +#include <type_traits> + +template <class T> +void test_is_abstract() +{ + static_assert( std::is_abstract<T>::value, ""); + static_assert( std::is_abstract<const T>::value, ""); + static_assert( std::is_abstract<volatile T>::value, ""); + static_assert( std::is_abstract<const volatile T>::value, ""); +} + +template <class T> +void test_is_not_abstract() +{ + static_assert(!std::is_abstract<T>::value, ""); + static_assert(!std::is_abstract<const T>::value, ""); + static_assert(!std::is_abstract<volatile T>::value, ""); + static_assert(!std::is_abstract<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +int main() +{ + test_is_not_abstract<void>(); + test_is_not_abstract<int&>(); + test_is_not_abstract<int>(); + test_is_not_abstract<double>(); + test_is_not_abstract<int*>(); + test_is_not_abstract<const int*>(); + test_is_not_abstract<char[3]>(); + test_is_not_abstract<char[3]>(); + test_is_not_abstract<Union>(); + test_is_not_abstract<Empty>(); + test_is_not_abstract<bit_zero>(); + test_is_not_abstract<NotEmpty>(); + + test_is_abstract<Abstract>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp index c56b78ba519..7aeefa5686f 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp @@ -1 +1,37 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_const
#include <type_traits>
template <class T>
void test_is_const()
{
static_assert(!std::is_const<T>::value, "");
static_assert( std::is_const<const T>::value, "");
static_assert(!std::is_const<volatile T>::value, "");
static_assert( std::is_const<const volatile T>::value, "");
}
int main()
{
test_is_const<void>();
test_is_const<int>();
test_is_const<double>();
test_is_const<int*>();
test_is_const<const int*>();
test_is_const<char[3]>();
test_is_const<char[3]>();
static_assert(!std::is_const<int&>::value, "");
static_assert(!std::is_const<const int&>::value, "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_const + +#include <type_traits> + +template <class T> +void test_is_const() +{ + static_assert(!std::is_const<T>::value, ""); + static_assert( std::is_const<const T>::value, ""); + static_assert(!std::is_const<volatile T>::value, ""); + static_assert( std::is_const<const volatile T>::value, ""); +} + +int main() +{ + test_is_const<void>(); + test_is_const<int>(); + test_is_const<double>(); + test_is_const<int*>(); + test_is_const<const int*>(); + test_is_const<char[3]>(); + test_is_const<char[3]>(); + + static_assert(!std::is_const<int&>::value, ""); + static_assert(!std::is_const<const int&>::value, ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index a4601fd9b6a..344ddcc03a1 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -1 +1,38 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// template <class T, class... Args>
// struct is_constructible;
#include <type_traits>
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
struct A
{
explicit A(int);
A(int, double);
};
#endif
int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
static_assert((std::is_constructible<int>::value), "");
static_assert((std::is_constructible<int, const int>::value), "");
static_assert((std::is_constructible<A, int>::value), "");
static_assert((std::is_constructible<A, int, double>::value), "");
static_assert((!std::is_constructible<A>::value), "");
#endif
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template <class T, class... Args> +// struct is_constructible; + +#include <type_traits> + +#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE + +struct A +{ + explicit A(int); + A(int, double); +}; + +#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE + +int main() +{ +#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE + + static_assert((std::is_constructible<int>::value), ""); + static_assert((std::is_constructible<int, const int>::value), ""); + static_assert((std::is_constructible<A, int>::value), ""); + static_assert((std::is_constructible<A, int, double>::value), ""); + static_assert((!std::is_constructible<A>::value), ""); + +#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp index e1dc14f7e70..1aebc0bcd65 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp @@ -1 +1,65 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_empty
#include <type_traits>
template <class T>
void test_is_empty()
{
static_assert( std::is_empty<T>::value, "");
static_assert( std::is_empty<const T>::value, "");
static_assert( std::is_empty<volatile T>::value, "");
static_assert( std::is_empty<const volatile T>::value, "");
}
template <class T>
void test_is_not_empty()
{
static_assert(!std::is_empty<T>::value, "");
static_assert(!std::is_empty<const T>::value, "");
static_assert(!std::is_empty<volatile T>::value, "");
static_assert(!std::is_empty<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
int main()
{
test_is_not_empty<void>();
test_is_not_empty<int&>();
test_is_not_empty<int>();
test_is_not_empty<double>();
test_is_not_empty<int*>();
test_is_not_empty<const int*>();
test_is_not_empty<char[3]>();
test_is_not_empty<char[3]>();
test_is_not_empty<Union>();
test_is_not_empty<NotEmpty>();
test_is_empty<Empty>();
test_is_empty<bit_zero>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_empty + +#include <type_traits> + +template <class T> +void test_is_empty() +{ + static_assert( std::is_empty<T>::value, ""); + static_assert( std::is_empty<const T>::value, ""); + static_assert( std::is_empty<volatile T>::value, ""); + static_assert( std::is_empty<const volatile T>::value, ""); +} + +template <class T> +void test_is_not_empty() +{ + static_assert(!std::is_empty<T>::value, ""); + static_assert(!std::is_empty<const T>::value, ""); + static_assert(!std::is_empty<volatile T>::value, ""); + static_assert(!std::is_empty<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +int main() +{ + test_is_not_empty<void>(); + test_is_not_empty<int&>(); + test_is_not_empty<int>(); + test_is_not_empty<double>(); + test_is_not_empty<int*>(); + test_is_not_empty<const int*>(); + test_is_not_empty<char[3]>(); + test_is_not_empty<char[3]>(); + test_is_not_empty<Union>(); + test_is_not_empty<NotEmpty>(); + + test_is_empty<Empty>(); + test_is_empty<bit_zero>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp index cbce73730c4..557206a3a39 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp @@ -1 +1,22 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_literal_type
#include <type_traits>
int main()
{
static_assert( std::is_literal_type<int>::value, "");
static_assert( std::is_literal_type<const int>::value, "");
static_assert(!std::is_literal_type<int&>::value, "");
static_assert(!std::is_literal_type<volatile int&>::value, "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_literal_type + +#include <type_traits> + +int main() +{ + static_assert( std::is_literal_type<int>::value, ""); + static_assert( std::is_literal_type<const int>::value, ""); + static_assert(!std::is_literal_type<int&>::value, ""); + static_assert(!std::is_literal_type<volatile int&>::value, ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp index 0974ee3aa33..57e176b7c17 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// template <class T, class... Args>
// struct is_nothrow_constructible;
#include <type_traits>
#ifndef _LIBCPP_HAS_NO_VARIADICS
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
struct A
{
A(const A&);
};
#endif
int main()
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
static_assert((std::is_nothrow_constructible<int, const int>::value), "");
#endif
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template <class T, class... Args> +// struct is_nothrow_constructible; + +#include <type_traits> + +#ifndef _LIBCPP_HAS_NO_VARIADICS + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +#endif // _LIBCPP_HAS_NO_VARIADICS + +int main() +{ +#ifndef _LIBCPP_HAS_NO_VARIADICS + static_assert((std::is_nothrow_constructible<int, const int>::value), ""); +#endif +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp index 8f783b0734a..a70d23ca15e 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp @@ -1 +1,52 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_pod
#include <type_traits>
template <class T>
void test_is_pod()
{
static_assert( std::is_pod<T>::value, "");
static_assert( std::is_pod<const T>::value, "");
static_assert( std::is_pod<volatile T>::value, "");
static_assert( std::is_pod<const volatile T>::value, "");
}
template <class T>
void test_is_not_pod()
{
static_assert(!std::is_pod<T>::value, "");
static_assert(!std::is_pod<const T>::value, "");
static_assert(!std::is_pod<volatile T>::value, "");
static_assert(!std::is_pod<const volatile T>::value, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_is_not_pod<void>();
test_is_not_pod<int&>();
test_is_not_pod<Class>();
test_is_pod<int>();
test_is_pod<double>();
test_is_pod<int*>();
test_is_pod<const int*>();
test_is_pod<char[3]>();
test_is_pod<char[3]>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_pod + +#include <type_traits> + +template <class T> +void test_is_pod() +{ + static_assert( std::is_pod<T>::value, ""); + static_assert( std::is_pod<const T>::value, ""); + static_assert( std::is_pod<volatile T>::value, ""); + static_assert( std::is_pod<const volatile T>::value, ""); +} + +template <class T> +void test_is_not_pod() +{ + static_assert(!std::is_pod<T>::value, ""); + static_assert(!std::is_pod<const T>::value, ""); + static_assert(!std::is_pod<volatile T>::value, ""); + static_assert(!std::is_pod<const volatile T>::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_not_pod<void>(); + test_is_not_pod<int&>(); + test_is_not_pod<Class>(); + + test_is_pod<int>(); + test_is_pod<double>(); + test_is_pod<int*>(); + test_is_pod<const int*>(); + test_is_pod<char[3]>(); + test_is_pod<char[3]>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp index 07004b9fa89..018478923a3 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp @@ -1 +1,71 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_polymorphic
#include <type_traits>
template <class T>
void test_is_polymorphic()
{
static_assert( std::is_polymorphic<T>::value, "");
static_assert( std::is_polymorphic<const T>::value, "");
static_assert( std::is_polymorphic<volatile T>::value, "");
static_assert( std::is_polymorphic<const volatile T>::value, "");
}
template <class T>
void test_is_not_polymorphic()
{
static_assert(!std::is_polymorphic<T>::value, "");
static_assert(!std::is_polymorphic<const T>::value, "");
static_assert(!std::is_polymorphic<volatile T>::value, "");
static_assert(!std::is_polymorphic<const volatile T>::value, "");
}
class Empty
{
};
class NotEmpty
{
virtual ~NotEmpty();
};
union Union {};
struct bit_zero
{
int : 0;
};
class Abstract
{
virtual ~Abstract() = 0;
};
int main()
{
test_is_not_polymorphic<void>();
test_is_not_polymorphic<int&>();
test_is_not_polymorphic<int>();
test_is_not_polymorphic<double>();
test_is_not_polymorphic<int*>();
test_is_not_polymorphic<const int*>();
test_is_not_polymorphic<char[3]>();
test_is_not_polymorphic<char[3]>();
test_is_not_polymorphic<Union>();
test_is_not_polymorphic<Empty>();
test_is_not_polymorphic<bit_zero>();
test_is_polymorphic<NotEmpty>();
test_is_polymorphic<Abstract>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_polymorphic + +#include <type_traits> + +template <class T> +void test_is_polymorphic() +{ + static_assert( std::is_polymorphic<T>::value, ""); + static_assert( std::is_polymorphic<const T>::value, ""); + static_assert( std::is_polymorphic<volatile T>::value, ""); + static_assert( std::is_polymorphic<const volatile T>::value, ""); +} + +template <class T> +void test_is_not_polymorphic() +{ + static_assert(!std::is_polymorphic<T>::value, ""); + static_assert(!std::is_polymorphic<const T>::value, ""); + static_assert(!std::is_polymorphic<volatile T>::value, ""); + static_assert(!std::is_polymorphic<const volatile T>::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +int main() +{ + test_is_not_polymorphic<void>(); + test_is_not_polymorphic<int&>(); + test_is_not_polymorphic<int>(); + test_is_not_polymorphic<double>(); + test_is_not_polymorphic<int*>(); + test_is_not_polymorphic<const int*>(); + test_is_not_polymorphic<char[3]>(); + test_is_not_polymorphic<char[3]>(); + test_is_not_polymorphic<Union>(); + test_is_not_polymorphic<Empty>(); + test_is_not_polymorphic<bit_zero>(); + + test_is_polymorphic<NotEmpty>(); + test_is_polymorphic<Abstract>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp index 0416e3a96b6..10b8f4e0cce 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp @@ -1 +1,54 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_signed
#include <type_traits>
template <class T>
void test_is_signed()
{
static_assert( std::is_signed<T>::value, "");
static_assert( std::is_signed<const T>::value, "");
static_assert( std::is_signed<volatile T>::value, "");
static_assert( std::is_signed<const volatile T>::value, "");
}
template <class T>
void test_is_not_signed()
{
static_assert(!std::is_signed<T>::value, "");
static_assert(!std::is_signed<const T>::value, "");
static_assert(!std::is_signed<volatile T>::value, "");
static_assert(!std::is_signed<const volatile T>::value, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_is_not_signed<void>();
test_is_not_signed<int&>();
test_is_not_signed<Class>();
test_is_not_signed<int*>();
test_is_not_signed<const int*>();
test_is_not_signed<char[3]>();
test_is_not_signed<char[3]>();
test_is_not_signed<bool>();
test_is_not_signed<unsigned>();
test_is_signed<int>();
test_is_signed<double>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_signed + +#include <type_traits> + +template <class T> +void test_is_signed() +{ + static_assert( std::is_signed<T>::value, ""); + static_assert( std::is_signed<const T>::value, ""); + static_assert( std::is_signed<volatile T>::value, ""); + static_assert( std::is_signed<const volatile T>::value, ""); +} + +template <class T> +void test_is_not_signed() +{ + static_assert(!std::is_signed<T>::value, ""); + static_assert(!std::is_signed<const T>::value, ""); + static_assert(!std::is_signed<volatile T>::value, ""); + static_assert(!std::is_signed<const volatile T>::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_not_signed<void>(); + test_is_not_signed<int&>(); + test_is_not_signed<Class>(); + test_is_not_signed<int*>(); + test_is_not_signed<const int*>(); + test_is_not_signed<char[3]>(); + test_is_not_signed<char[3]>(); + test_is_not_signed<bool>(); + test_is_not_signed<unsigned>(); + + test_is_signed<int>(); + test_is_signed<double>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp index ede3b834a5f..7371adbe6bb 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp @@ -1 +1,21 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_standard_layout
#include <type_traits>
int main()
{
static_assert( std::is_standard_layout<int>::value, "");
static_assert(!std::is_standard_layout<int&>::value, "");
static_assert(!std::is_standard_layout<volatile int&>::value, "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_standard_layout + +#include <type_traits> + +int main() +{ + static_assert( std::is_standard_layout<int>::value, ""); + static_assert(!std::is_standard_layout<int&>::value, ""); + static_assert(!std::is_standard_layout<volatile int&>::value, ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp index 3a48ccab228..05262b6cf53 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp @@ -1 +1,21 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_trivial
#include <type_traits>
int main()
{
static_assert( std::is_trivial<int>::value, "");
static_assert(!std::is_trivial<int&>::value, "");
static_assert(!std::is_trivial<volatile int&>::value, "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivial + +#include <type_traits> + +int main() +{ + static_assert( std::is_trivial<int>::value, ""); + static_assert(!std::is_trivial<int&>::value, ""); + static_assert(!std::is_trivial<volatile int&>::value, ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp index b589c2b9291..4046dbbc30d 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp @@ -1 +1,37 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_trivially_copyable
#include <type_traits>
#include <cassert>
struct A
{
int i_;
};
struct B
{
int i_;
~B() {assert(i_ == 0);}
};
int main()
{
static_assert( std::is_trivially_copyable<int>::value, "");
static_assert( std::is_trivially_copyable<const int>::value, "");
static_assert(!std::is_trivially_copyable<int&>::value, "");
static_assert( std::is_trivially_copyable<A>::value, "");
static_assert( std::is_trivially_copyable<const A>::value, "");
static_assert(!std::is_trivially_copyable<const A&>::value, "");
static_assert(!std::is_trivially_copyable<B>::value, "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_copyable + +#include <type_traits> +#include <cassert> + +struct A +{ + int i_; +}; + +struct B +{ + int i_; + ~B() {assert(i_ == 0);} +}; + +int main() +{ + static_assert( std::is_trivially_copyable<int>::value, ""); + static_assert( std::is_trivially_copyable<const int>::value, ""); + static_assert(!std::is_trivially_copyable<int&>::value, ""); + static_assert( std::is_trivially_copyable<A>::value, ""); + static_assert( std::is_trivially_copyable<const A>::value, ""); + static_assert(!std::is_trivially_copyable<const A&>::value, ""); + static_assert(!std::is_trivially_copyable<B>::value, ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp index 9967cc4ab41..d5696feb828 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp @@ -1 +1,54 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_unsigned
#include <type_traits>
template <class T>
void test_is_unsigned()
{
static_assert( std::is_unsigned<T>::value, "");
static_assert( std::is_unsigned<const T>::value, "");
static_assert( std::is_unsigned<volatile T>::value, "");
static_assert( std::is_unsigned<const volatile T>::value, "");
}
template <class T>
void test_is_not_unsigned()
{
static_assert(!std::is_unsigned<T>::value, "");
static_assert(!std::is_unsigned<const T>::value, "");
static_assert(!std::is_unsigned<volatile T>::value, "");
static_assert(!std::is_unsigned<const volatile T>::value, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_is_not_unsigned<void>();
test_is_not_unsigned<int&>();
test_is_not_unsigned<Class>();
test_is_not_unsigned<int*>();
test_is_not_unsigned<const int*>();
test_is_not_unsigned<char[3]>();
test_is_not_unsigned<char[3]>();
test_is_not_unsigned<int>();
test_is_not_unsigned<double>();
test_is_unsigned<bool>();
test_is_unsigned<unsigned>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_unsigned + +#include <type_traits> + +template <class T> +void test_is_unsigned() +{ + static_assert( std::is_unsigned<T>::value, ""); + static_assert( std::is_unsigned<const T>::value, ""); + static_assert( std::is_unsigned<volatile T>::value, ""); + static_assert( std::is_unsigned<const volatile T>::value, ""); +} + +template <class T> +void test_is_not_unsigned() +{ + static_assert(!std::is_unsigned<T>::value, ""); + static_assert(!std::is_unsigned<const T>::value, ""); + static_assert(!std::is_unsigned<volatile T>::value, ""); + static_assert(!std::is_unsigned<const volatile T>::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_not_unsigned<void>(); + test_is_not_unsigned<int&>(); + test_is_not_unsigned<Class>(); + test_is_not_unsigned<int*>(); + test_is_not_unsigned<const int*>(); + test_is_not_unsigned<char[3]>(); + test_is_not_unsigned<char[3]>(); + test_is_not_unsigned<int>(); + test_is_not_unsigned<double>(); + + test_is_unsigned<bool>(); + test_is_unsigned<unsigned>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp index 00ff887e696..92a46bd9077 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp @@ -1 +1,37 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// is_volatile
#include <type_traits>
template <class T>
void test_is_volatile()
{
static_assert(!std::is_volatile<T>::value, "");
static_assert(!std::is_volatile<const T>::value, "");
static_assert( std::is_volatile<volatile T>::value, "");
static_assert( std::is_volatile<const volatile T>::value, "");
}
int main()
{
test_is_volatile<void>();
test_is_volatile<int>();
test_is_volatile<double>();
test_is_volatile<int*>();
test_is_volatile<const int*>();
test_is_volatile<char[3]>();
test_is_volatile<char[3]>();
static_assert(!std::is_volatile<int&>::value, "");
static_assert(!std::is_volatile<volatile int&>::value, "");
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_volatile + +#include <type_traits> + +template <class T> +void test_is_volatile() +{ + static_assert(!std::is_volatile<T>::value, ""); + static_assert(!std::is_volatile<const T>::value, ""); + static_assert( std::is_volatile<volatile T>::value, ""); + static_assert( std::is_volatile<const volatile T>::value, ""); +} + +int main() +{ + test_is_volatile<void>(); + test_is_volatile<int>(); + test_is_volatile<double>(); + test_is_volatile<int*>(); + test_is_volatile<const int*>(); + test_is_volatile<char[3]>(); + test_is_volatile<char[3]>(); + + static_assert(!std::is_volatile<int&>::value, ""); + static_assert(!std::is_volatile<volatile int&>::value, ""); +} diff --git a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp index 0cd61f685f0..d2e4702e886 100644 --- a/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp @@ -1 +1,46 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// rank
#include <type_traits>
template <class T, unsigned A>
void test_rank()
{
static_assert( std::rank<T>::value == A, "");
static_assert( std::rank<const T>::value == A, "");
static_assert( std::rank<volatile T>::value == A, "");
static_assert( std::rank<const volatile T>::value == A, "");
}
class Class
{
public:
~Class();
};
int main()
{
test_rank<void, 0>();
test_rank<int&, 0>();
test_rank<Class, 0>();
test_rank<int*, 0>();
test_rank<const int*, 0>();
test_rank<int, 0>();
test_rank<double, 0>();
test_rank<bool, 0>();
test_rank<unsigned, 0>();
test_rank<char[3], 1>();
test_rank<char[][3], 2>();
test_rank<char[][4][3], 3>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// rank + +#include <type_traits> + +template <class T, unsigned A> +void test_rank() +{ + static_assert( std::rank<T>::value == A, ""); + static_assert( std::rank<const T>::value == A, ""); + static_assert( std::rank<volatile T>::value == A, ""); + static_assert( std::rank<const volatile T>::value == A, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_rank<void, 0>(); + test_rank<int&, 0>(); + test_rank<Class, 0>(); + test_rank<int*, 0>(); + test_rank<const int*, 0>(); + test_rank<int, 0>(); + test_rank<double, 0>(); + test_rank<bool, 0>(); + test_rank<unsigned, 0>(); + + test_rank<char[3], 1>(); + test_rank<char[][3], 2>(); + test_rank<char[][4][3], 3>(); +} diff --git a/libcxx/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp b/libcxx/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp index e8db90cbee0..b89f168e9c4 100644 --- a/libcxx/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp +++ b/libcxx/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp @@ -1 +1,12 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/utilities/meta/version.pass.cpp b/libcxx/test/utilities/meta/version.pass.cpp index 513d4080a53..9aa7c8c096f 100644 --- a/libcxx/test/utilities/meta/version.pass.cpp +++ b/libcxx/test/utilities/meta/version.pass.cpp @@ -1 +1,20 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <type_traits>
#include <type_traits>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <type_traits> + +#include <type_traits> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} |

