diff options
39 files changed, 3113 insertions, 431 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 48b27d6..eb87a87 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,73 @@ +2011-04-13 Daniel Krugler <daniel.kruegler@googlemail.com> + Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/48526 + * include/std/type_traits (struct is_constructible): Re-implement, + according to n3290. + (struct is_default_constructible): Add. + (struct is_destructible): Likewise. + (struct __and_, __or_, __not_): Add and use throughout; reorder some + facilities, other minor tweaks. + * testsuite/util/testsuite_tr1.h: Add test types. + * testsuite/20_util/is_constructible/value-2.cc: New. + * testsuite/20_util/is_default_constructible/value.cc: Likewise. + * testsuite/20_util/is_default_constructible/requirements/typedefs.cc: + Likewise. + * testsuite/20_util/is_default_constructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_destructible/value.cc: Likewise. + * testsuite/20_util/is_destructible/requirements/typedefs.cc: + Likewise. + * testsuite/20_util/is_destructible/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust + dg-error line numbers. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: + Likewise. + * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. + * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise. + +2011-04-13 Paolo Carlini <paolo.carlini@oracle.com> + + * testsuite/20_util/is_function/value.cc: Add, adapted from the tr + testsuite. + * testsuite/20_util/is_function/requirements/typedefs.cc: Likewise. + * testsuite/20_util/is_function/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_function/24808.cc: Likewise. + * testsuite/20_util/is_function/35637.cc: Likewise. + * testsuite/20_util/is_object/value.cc: Likewise. + * testsuite/20_util/is_object/requirements/typedefs.cc: Likewise. + * testsuite/20_util/is_object/requirements/explicit_instantiation.cc: + : Likewise. + * testsuite/20_util/is_object/24808.cc: Likewise. + * testsuite/20_util/is_compound/value.cc: Likewise. + * testsuite/20_util/is_compound/requirements/typedefs.cc: Likewise. + * testsuite/20_util/is_compound/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_member_object_pointer/value.cc: Likewise. + * testsuite/20_util/is_member_object_pointer/requirements/ + typedefs.cc: Likewise. + * testsuite/20_util/is_member_object_pointer/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_fundamental/value.cc: Likewise. + * testsuite/20_util/is_fundamental/requirements/typedefs.cc: Likewise. + * testsuite/20_util/is_fundamental/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_member_pointer/value.cc: Likewise. + * testsuite/20_util/is_member_pointer/requirements/typedefs.cc: + Likewise. + * testsuite/20_util/is_member_pointer/requirements/ + explicit_instantiation.cc: Likewise. + * testsuite/20_util/is_member_function_pointer/value.cc: Likewise. + * testsuite/20_util/is_member_function_pointer/ + requirements/typedefs.cc: Likewise. + * testsuite/20_util/is_member_function_pointer/requirements/ + explicit_instantiation.cc: Likewise. + + * testsuite/20_util/is_convertible/value.cc: Minor tweak, adjust + Copyright years. + 2011-04-12 Takaya Saito <gintensubaru@gmail.com> PR libstdc++/48476 diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index f5d867b..a4c7673 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1,6 +1,6 @@ // C++0x type_traits -*- C++ -*- -// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -51,21 +51,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef struct { char __arr[2]; } __two; }; -#define _DEFINE_SPEC_0_HELPER \ - template<> + // Meta programming helper types. -#define _DEFINE_SPEC_1_HELPER \ - template<typename _Tp> + template<bool, typename, typename> + struct conditional; -#define _DEFINE_SPEC_2_HELPER \ - template<typename _Tp, typename _Cp> + template<typename _Tp, _Tp> + struct integral_constant; + + template<typename, typename, typename...> + struct __or_; + + template<typename _B1, typename _B2> + struct __or_<_B1, _B2> + : public conditional<_B1::value, _B1, _B2>::type + { }; + + template<typename _B1, typename _B2, typename _B3, typename... _Bn> + struct __or_<_B1, _B2, _B3, _Bn...> + : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type + { }; + + template<typename, typename, typename...> + struct __and_; + + template<typename _B1, typename _B2> + struct __and_<_B1, _B2> + : public conditional<_B1::value, _B2, _B1>::type + { }; -#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \ - _DEFINE_SPEC_##_Order##_HELPER \ - struct _Trait<_Type> \ - : public integral_constant<bool, _Value> { }; + template<typename _B1, typename _B2, typename _B3, typename... _Bn> + struct __and_<_B1, _B2, _B3, _Bn...> + : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type + { }; + + template<typename _Pp> + struct __not_ + : public integral_constant<bool, !_Pp::value> + { }; - // helper classes. + // helper class. /// integral_constant template<typename _Tp, _Tp __v> @@ -86,16 +111,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp, _Tp __v> constexpr _Tp integral_constant<_Tp, __v>::value; - /// remove_cv + // primary type categories. + template<typename> struct remove_cv; template<typename> struct __is_void_helper : public false_type { }; - _DEFINE_SPEC(0, __is_void_helper, void, true) - // primary type categories. + template<> + struct __is_void_helper<void> + : public true_type { }; /// is_void template<typename _Tp> @@ -107,23 +134,68 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct __is_integral_helper : public false_type { }; - _DEFINE_SPEC(0, __is_integral_helper, bool, true) - _DEFINE_SPEC(0, __is_integral_helper, char, true) - _DEFINE_SPEC(0, __is_integral_helper, signed char, true) - _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true) + + template<> + struct __is_integral_helper<bool> + : public true_type { }; + + template<> + struct __is_integral_helper<char> + : public true_type { }; + + template<> + struct __is_integral_helper<signed char> + : public true_type { }; + + template<> + struct __is_integral_helper<unsigned char> + : public true_type { }; + #ifdef _GLIBCXX_USE_WCHAR_T - _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true) + template<> + struct __is_integral_helper<wchar_t> + : public true_type { }; #endif - _DEFINE_SPEC(0, __is_integral_helper, char16_t, true) - _DEFINE_SPEC(0, __is_integral_helper, char32_t, true) - _DEFINE_SPEC(0, __is_integral_helper, short, true) - _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true) - _DEFINE_SPEC(0, __is_integral_helper, int, true) - _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true) - _DEFINE_SPEC(0, __is_integral_helper, long, true) - _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true) - _DEFINE_SPEC(0, __is_integral_helper, long long, true) - _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true) + + template<> + struct __is_integral_helper<char16_t> + : public true_type { }; + + template<> + struct __is_integral_helper<char32_t> + : public true_type { }; + + template<> + struct __is_integral_helper<short> + : public true_type { }; + + template<> + struct __is_integral_helper<unsigned short> + : public true_type { }; + + template<> + struct __is_integral_helper<int> + : public true_type { }; + + template<> + struct __is_integral_helper<unsigned int> + : public true_type { }; + + template<> + struct __is_integral_helper<long> + : public true_type { }; + + template<> + struct __is_integral_helper<unsigned long> + : public true_type { }; + + template<> + struct __is_integral_helper<long long> + : public true_type { }; + + template<> + struct __is_integral_helper<unsigned long long> + : public true_type { }; /// is_integral template<typename _Tp> @@ -135,9 +207,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct __is_floating_point_helper : public false_type { }; - _DEFINE_SPEC(0, __is_floating_point_helper, float, true) - _DEFINE_SPEC(0, __is_floating_point_helper, double, true) - _DEFINE_SPEC(0, __is_floating_point_helper, long double, true) + + template<> + struct __is_floating_point_helper<float> + : public true_type { }; + + template<> + struct __is_floating_point_helper<double> + : public true_type { }; + + template<> + struct __is_floating_point_helper<long double> + : public true_type { }; /// is_floating_point template<typename _Tp> @@ -162,7 +243,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct __is_pointer_helper : public false_type { }; - _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true) + + template<typename _Tp> + struct __is_pointer_helper<_Tp*> + : public true_type { }; /// is_pointer template<typename _Tp> @@ -171,19 +255,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION remove_cv<_Tp>::type>::value)> { }; - /// is_reference + /// is_lvalue_reference + template<typename> + struct is_lvalue_reference + : public false_type { }; + template<typename _Tp> - struct is_reference; + struct is_lvalue_reference<_Tp&> + : public true_type { }; + + /// is_rvalue_reference + template<typename> + struct is_rvalue_reference + : public false_type { }; - /// is_function template<typename _Tp> + struct is_rvalue_reference<_Tp&&> + : public true_type { }; + + template<typename> struct is_function; template<typename> struct __is_member_object_pointer_helper : public false_type { }; - _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*, - !is_function<_Tp>::value) + + template<typename _Tp, typename _Cp> + struct __is_member_object_pointer_helper<_Tp _Cp::*> + : public integral_constant<bool, !is_function<_Tp>::value> { }; /// is_member_object_pointer template<typename _Tp> @@ -195,8 +294,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct __is_member_function_pointer_helper : public false_type { }; - _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*, - is_function<_Tp>::value) + + template<typename _Tp, typename _Cp> + struct __is_member_function_pointer_helper<_Tp _Cp::*> + : public integral_constant<bool, is_function<_Tp>::value> { }; /// is_member_function_pointer template<typename _Tp> @@ -227,27 +328,35 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct is_function : public false_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...)> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......)> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) const> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) const> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) volatile> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) volatile> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes...) const volatile> : public true_type { }; + template<typename _Res, typename... _ArgTypes> struct is_function<_Res(_ArgTypes......) const volatile> : public true_type { }; @@ -255,7 +364,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct __is_nullptr_t_helper : public false_type { }; - _DEFINE_SPEC(0, __is_nullptr_t_helper, std::nullptr_t, true) + + template<> + struct __is_nullptr_t_helper<std::nullptr_t> + : public true_type { }; // __is_nullptr_t (extension). template<typename _Tp> @@ -264,42 +376,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION remove_cv<_Tp>::type>::value)> { }; - // composite type traits. - + // composite type categories. + + /// is_reference + template<typename _Tp> + struct is_reference + : public __or_<is_lvalue_reference<_Tp>, + is_rvalue_reference<_Tp>>::type + { }; + /// is_arithmetic template<typename _Tp> struct is_arithmetic - : public integral_constant<bool, (is_integral<_Tp>::value - || is_floating_point<_Tp>::value)> + : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type { }; /// is_fundamental template<typename _Tp> struct is_fundamental - : public integral_constant<bool, (is_arithmetic<_Tp>::value - || is_void<_Tp>::value)> + : public __or_<is_arithmetic<_Tp>, is_void<_Tp>>::type { }; /// is_object template<typename _Tp> struct is_object - : public integral_constant<bool, !(is_function<_Tp>::value - || is_reference<_Tp>::value - || is_void<_Tp>::value)> + : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>, + is_void<_Tp>>>::type { }; - /// is_member_pointer - template<typename _Tp> + template<typename> struct is_member_pointer; /// is_scalar template<typename _Tp> struct is_scalar - : public integral_constant<bool, (is_arithmetic<_Tp>::value - || is_enum<_Tp>::value - || is_pointer<_Tp>::value - || is_member_pointer<_Tp>::value - || __is_nullptr_t<_Tp>::value)> + : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>, + is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type { }; /// is_compound @@ -311,15 +423,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp> struct __is_member_pointer_helper : public false_type { }; - _DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true) + + template<typename _Tp, typename _Cp> + struct __is_member_pointer_helper<_Tp _Cp::*> + : public true_type { }; template<typename _Tp> - struct is_member_pointer + struct is_member_pointer : public integral_constant<bool, (__is_member_pointer_helper< typename remove_cv<_Tp>::type>::value)> { }; // type properties. + /// is_const template<typename> struct is_const @@ -338,6 +454,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_volatile<_Tp volatile> : public true_type { }; + /// is_trivial + template<typename _Tp> + struct is_trivial + : public integral_constant<bool, __is_trivial(_Tp)> + { }; + + /// is_trivially_copyable (still unimplemented) + + /// is_standard_layout + template<typename _Tp> + struct is_standard_layout + : public integral_constant<bool, __is_standard_layout(_Tp)> + { }; + + /// is_pod + // Could use is_standard_layout && is_trivial instead of the builtin. + template<typename _Tp> + struct is_pod + : public integral_constant<bool, __is_pod(_Tp)> + { }; + + /// is_literal_type + template<typename _Tp> + struct is_literal_type + : public integral_constant<bool, __is_literal_type(_Tp)> + { }; + /// is_empty template<typename _Tp> struct is_empty @@ -356,336 +499,362 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, __is_abstract(_Tp)> { }; - /// has_virtual_destructor - template<typename _Tp> - struct has_virtual_destructor - : public integral_constant<bool, __has_virtual_destructor(_Tp)> - { }; + template<typename _Tp, + bool = is_integral<_Tp>::value, + bool = is_floating_point<_Tp>::value> + struct __is_signed_helper + : public false_type { }; - /// alignment_of template<typename _Tp> - struct alignment_of - : public integral_constant<std::size_t, __alignof__(_Tp)> { }; - - /// rank - template<typename> - struct rank - : public integral_constant<std::size_t, 0> { }; - - template<typename _Tp, std::size_t _Size> - struct rank<_Tp[_Size]> - : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; + struct __is_signed_helper<_Tp, false, true> + : public true_type { }; template<typename _Tp> - struct rank<_Tp[]> - : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; + struct __is_signed_helper<_Tp, true, false> + : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))> + { }; - /// extent - template<typename, unsigned _Uint = 0> - struct extent - : public integral_constant<std::size_t, 0> { }; - - template<typename _Tp, unsigned _Uint, std::size_t _Size> - struct extent<_Tp[_Size], _Uint> - : public integral_constant<std::size_t, - _Uint == 0 ? _Size : extent<_Tp, - _Uint - 1>::value> + /// is_signed + template<typename _Tp> + struct is_signed + : public integral_constant<bool, __is_signed_helper<_Tp>::value> { }; - template<typename _Tp, unsigned _Uint> - struct extent<_Tp[], _Uint> - : public integral_constant<std::size_t, - _Uint == 0 ? 0 : extent<_Tp, - _Uint - 1>::value> + /// is_unsigned + template<typename _Tp> + struct is_unsigned + : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type { }; - // relationships between types [4.6]. - /// is_same - template<typename, typename> - struct is_same - : public false_type { }; + // destructible and constructible type properties + + template<typename> + struct add_rvalue_reference; template<typename _Tp> - struct is_same<_Tp, _Tp> - : public true_type { }; + typename add_rvalue_reference<_Tp>::type declval() noexcept; - // const-volatile modifications [4.7.1]. + template<typename, unsigned = 0> + struct extent; - /// remove_const - template<typename _Tp> - struct remove_const - { typedef _Tp type; }; + template<typename> + struct remove_all_extents; template<typename _Tp> - struct remove_const<_Tp const> - { typedef _Tp type; }; - - /// remove_volatile - template<typename _Tp> - struct remove_volatile - { typedef _Tp type; }; + struct __is_array_known_bounds + : public integral_constant<bool, (extent<_Tp>::value > 0)> + { }; template<typename _Tp> - struct remove_volatile<_Tp volatile> - { typedef _Tp type; }; - - /// remove_cv - template<typename _Tp> - struct remove_cv - { - typedef typename - remove_const<typename remove_volatile<_Tp>::type>::type type; - }; - - /// add_const - template<typename _Tp> - struct add_const - { typedef _Tp const type; }; - - /// add_volatile - template<typename _Tp> - struct add_volatile - { typedef _Tp volatile type; }; - - /// add_cv - template<typename _Tp> - struct add_cv - { - typedef typename - add_const<typename add_volatile<_Tp>::type>::type type; - }; + struct __is_array_unknown_bounds + : public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type + { }; - // array modifications. + struct __do_is_destructible_impl_1 + { + template<typename _Up> + struct __w { _Up __u; }; - /// remove_extent - template<typename _Tp> - struct remove_extent - { typedef _Tp type; }; + template<typename _Tp, typename + = decltype(declval<__w<_Tp>&>().~__w<_Tp>())> + static true_type __test(int); - template<typename _Tp, std::size_t _Size> - struct remove_extent<_Tp[_Size]> - { typedef _Tp type; }; + template<typename> + static false_type __test(...); + }; template<typename _Tp> - struct remove_extent<_Tp[]> - { typedef _Tp type; }; + struct __is_destructible_impl_1 + : public __do_is_destructible_impl_1 + { + typedef decltype(__test<_Tp>(0)) type; + }; - /// remove_all_extents - template<typename _Tp> - struct remove_all_extents - { typedef _Tp type; }; + struct __do_is_destructible_impl_2 + { + template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())> + static true_type __test(int); - template<typename _Tp, std::size_t _Size> - struct remove_all_extents<_Tp[_Size]> - { typedef typename remove_all_extents<_Tp>::type type; }; + template<typename> + static false_type __test(...); + }; template<typename _Tp> - struct remove_all_extents<_Tp[]> - { typedef typename remove_all_extents<_Tp>::type type; }; - - // pointer modifications. - - template<typename _Tp, typename> - struct __remove_pointer_helper - { typedef _Tp type; }; + struct __is_destructible_impl_2 + : public __do_is_destructible_impl_2 + { + typedef decltype(__test<_Tp>(0)) type; + }; - template<typename _Tp, typename _Up> - struct __remove_pointer_helper<_Tp, _Up*> - { typedef _Up type; }; + template<typename _Tp, + bool = __or_<is_void<_Tp>, + __is_array_unknown_bounds<_Tp>>::value, + bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value> + struct __is_destructible_safe; - /// remove_pointer template<typename _Tp> - struct remove_pointer - : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> + struct __is_destructible_safe<_Tp, false, false> + : public conditional<is_abstract<_Tp>::value, + __is_destructible_impl_2<_Tp>, + __is_destructible_impl_1<_Tp>>::type::type { }; - template<typename> - struct remove_reference; - - /// add_pointer template<typename _Tp> - struct add_pointer - { typedef typename remove_reference<_Tp>::type* type; }; - - // Primary classification traits. - - /// is_lvalue_reference - template<typename> - struct is_lvalue_reference + struct __is_destructible_safe<_Tp, true, false> : public false_type { }; template<typename _Tp> - struct is_lvalue_reference<_Tp&> + struct __is_destructible_safe<_Tp, false, true> : public true_type { }; - /// is_rvalue_reference - template<typename> - struct is_rvalue_reference - : public false_type { }; - - template<typename _Tp> - struct is_rvalue_reference<_Tp&&> - : public true_type { }; - - // Secondary classification traits. - - /// is_reference + /// is_destructible template<typename _Tp> - struct is_reference - : public integral_constant<bool, (is_lvalue_reference<_Tp>::value - || is_rvalue_reference<_Tp>::value)> + struct is_destructible + : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)> { }; - // Reference transformations. + struct __do_is_default_constructible_impl + { + template<typename _Tp, typename = decltype(_Tp())> + static true_type __test(int); - /// remove_reference - template<typename _Tp> - struct remove_reference - { typedef _Tp type; }; + template<typename> + static false_type __test(...); + }; template<typename _Tp> - struct remove_reference<_Tp&> - { typedef _Tp type; }; + struct __is_default_constructible_impl + : public __do_is_default_constructible_impl + { + typedef decltype(__test<_Tp>(0)) type; + }; template<typename _Tp> - struct remove_reference<_Tp&&> - { typedef _Tp type; }; + struct __is_default_constructible_atom + : public __and_<is_destructible<_Tp>, + __is_default_constructible_impl<_Tp>>::type::type + { }; - template<typename _Tp, - bool = !is_reference<_Tp>::value && !is_void<_Tp>::value, - bool = is_rvalue_reference<_Tp>::value> - struct __add_lvalue_reference_helper - { typedef _Tp type; }; + template<typename _Tp, bool = is_array<_Tp>::value> + struct __is_default_constructible_safe; + + // The following technique is a workaround for a gcc defect, which does + // not sfinae away attempts to default-construct arrays of unknown bounds. + // Complete arrays can be default-constructed, if the element type is + // default-constructible, but arrays with unknown bounds are not: template<typename _Tp> - struct __add_lvalue_reference_helper<_Tp, true, false> - { typedef _Tp& type; }; + struct __is_default_constructible_safe<_Tp, true> + : public __and_<__is_array_known_bounds<_Tp>, + __is_default_constructible_atom<typename + remove_all_extents<_Tp>::type>>::type::type + { }; template<typename _Tp> - struct __add_lvalue_reference_helper<_Tp, false, true> - { typedef typename remove_reference<_Tp>::type& type; }; + struct __is_default_constructible_safe<_Tp, false> + : public __is_default_constructible_atom<_Tp>::type + { }; - /// add_lvalue_reference + /// is_default_constructible template<typename _Tp> - struct add_lvalue_reference - : public __add_lvalue_reference_helper<_Tp> + struct is_default_constructible + : public integral_constant<bool, (__is_default_constructible_safe< + _Tp>::value)> { }; - template<typename _Tp, - bool = !is_reference<_Tp>::value && !is_void<_Tp>::value> - struct __add_rvalue_reference_helper - { typedef _Tp type; }; + struct __do_is_static_castable_impl + { + template<typename _From, typename _To, typename + = decltype(static_cast<_To>(declval<_From>()))> + static true_type __test(int); - template<typename _Tp> - struct __add_rvalue_reference_helper<_Tp, true> - { typedef _Tp&& type; }; + template<typename, typename> + static false_type __test(...); + }; - /// add_rvalue_reference - template<typename _Tp> - struct add_rvalue_reference - : public __add_rvalue_reference_helper<_Tp> + template<typename _From, typename _To> + struct __is_static_castable_impl + : public __do_is_static_castable_impl + { + typedef decltype(__test<_From, _To>(0)) type; + }; + + template<typename _From, typename _To> + struct __is_static_castable_safe + : public __and_<__or_<is_void<_To>, is_destructible<_To>>, + __is_static_castable_impl<_From, _To>>::type::type { }; - // Scalar properties and transformations. + // __is_static_castable + template<typename _From, typename _To> + struct __is_static_castable + : public integral_constant<bool, (__is_static_castable_safe< + _From, _To>::value)> + { }; - template<typename _Tp, - bool = is_integral<_Tp>::value, - bool = is_floating_point<_Tp>::value> - struct __is_signed_helper - : public false_type { }; + struct __do_is_direct_constructible_impl + { + template<typename _Tp, typename _Arg, typename + = decltype(::new _Tp(declval<_Arg>()))> + static true_type __test(int); - template<typename _Tp> - struct __is_signed_helper<_Tp, false, true> - : public true_type { }; + template<typename, typename> + static false_type __test(...); + }; - template<typename _Tp> - struct __is_signed_helper<_Tp, true, false> - : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))> - { }; + template<typename _Tp, typename _Arg> + struct __is_direct_constructible_impl + : public __do_is_direct_constructible_impl + { + typedef decltype(__test<_Tp, _Arg>(0)) type; + }; - /// is_signed - template<typename _Tp> - struct is_signed - : public integral_constant<bool, __is_signed_helper<_Tp>::value> + template<typename _Tp, typename _Arg> + struct __is_direct_constructible_new_safe + : public __and_<is_destructible<_Tp>, + __is_direct_constructible_impl<_Tp, _Arg>>::type::type { }; - /// is_unsigned - template<typename _Tp> - struct is_unsigned - : public integral_constant<bool, (is_arithmetic<_Tp>::value - && !is_signed<_Tp>::value)> + template<typename, typename> + struct is_same; + + template<typename, typename> + struct is_base_of; + + template<typename> + struct remove_reference; + + template<typename _From, typename _To, bool + = is_reference<_From>::value> + struct __is_base_to_derived_ref; + + template<typename _From, typename _To> + struct __is_base_to_derived_ref<_From, _To, true> + { + typedef typename remove_cv<typename remove_reference<_From + >::type>::type __src_t; + typedef typename remove_cv<typename remove_reference<_To + >::type>::type __dst_t; + typedef typename __and_< + __not_<is_same<__src_t, __dst_t>>, + is_base_of<__src_t, __dst_t> + >::type type; + static constexpr bool value = type::value; + }; + + template<typename _From, typename _To> + struct __is_base_to_derived_ref<_From, _To, false> + : public false_type { }; - // Member introspection. + template<typename _From, typename _To, bool + = __and_<is_lvalue_reference<_From>, + is_rvalue_reference<_To>>::value> + struct __is_lvalue_to_rvalue_ref; - /// is_trivial - template<typename _Tp> - struct is_trivial - : public integral_constant<bool, __is_trivial(_Tp)> + template<typename _From, typename _To> + struct __is_lvalue_to_rvalue_ref<_From, _To, true> + { + typedef typename remove_cv<typename remove_reference< + _From>::type>::type __src_t; + typedef typename remove_cv<typename remove_reference< + _To>::type>::type __dst_t; + typedef typename __or_< + is_same<__src_t, __dst_t>, + is_base_of<__dst_t, __src_t> + >::type type; + static constexpr bool value = type::value; + }; + + template<typename _From, typename _To> + struct __is_lvalue_to_rvalue_ref<_From, _To, false> + : public false_type { }; - /// is_standard_layout - template<typename _Tp> - struct is_standard_layout - : public integral_constant<bool, __is_standard_layout(_Tp)> + // Here we handle direct-initialization to a reference type + // as equivalent to a static_cast modulo overshooting conversions. + // These are restricted to the following conversion: + // a) A base class to a derived class reference + // b) An lvalue-reference to an rvalue-reference + + template<typename _Tp, typename _Arg> + struct __is_direct_constructible_ref_cast + : public __and_<__is_static_castable<_Arg, _Tp>, + __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>, + __is_lvalue_to_rvalue_ref<_Arg, _Tp> + >>>::type::type { }; - /// is_pod - // Could use is_standard_layout && is_trivial instead of the builtin. - template<typename _Tp> - struct is_pod - : public integral_constant<bool, __is_pod(_Tp)> + // Direct-initialization is tricky, because of functional + // casts: For a conversion to reference we fall back to a + // static_cast modulo extra cases, otherwise we use a + // new expression: + + template<typename _Tp, typename _Arg> + struct __is_direct_constructible_new + : public conditional<is_reference<_Tp>::value, + __is_direct_constructible_ref_cast<_Tp, _Arg>, + __is_direct_constructible_new_safe<_Tp, _Arg> + >::type { }; - /// is_literal_type - template<typename _Tp> - struct is_literal_type - : public integral_constant<bool, __is_literal_type(_Tp)> + template<typename _Tp, typename _Arg> + struct __is_direct_constructible + : public integral_constant<bool, (__is_direct_constructible_new< + _Tp, _Arg>::type::value)> { }; - template<typename _Tp> - typename add_rvalue_reference<_Tp>::type declval() noexcept; + struct __do_is_nary_constructible_impl + { + template<typename _Tp, typename... _Args, typename + = decltype(_Tp(declval<_Args>()...))> + static true_type __test(int); + + template<typename, typename...> + static false_type __test(...); + }; template<typename _Tp, typename... _Args> - class __is_constructible_helper - : public __sfinae_types + struct __is_nary_constructible_impl + : public __do_is_nary_constructible_impl { - template<typename _Tp1, typename... _Args1> - static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int); - - template<typename, typename...> - static __two __test(...); - - public: - static const bool __value = sizeof(__test<_Tp, _Args...>(0)) == 1; + typedef decltype(__test<_Tp, _Args...>(0)) type; }; - template<typename _Tp, typename _Arg> - class __is_constructible_helper<_Tp, _Arg> - : public __sfinae_types + template<typename _Tp, typename... _Args> + struct __is_nary_constructible + : public __and_<is_destructible<_Tp>, + __is_nary_constructible_impl<_Tp, _Args...> + >::type::type { - template<typename _Tp1, typename _Arg1> - static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one()) - __test(int); + static_assert(sizeof...(_Args) > 1, + "Only useful for > 1 arguments"); + }; - template<typename, typename> - static __two __test(...); + template<typename _Tp, typename... _Args> + struct __is_constructible_impl + : public __is_nary_constructible<_Tp, _Args...> + { }; - public: - static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1; - }; + template<typename _Tp, typename _Arg> + struct __is_constructible_impl<_Tp, _Arg> + : public __is_direct_constructible<_Tp, _Arg> + { }; + + template<typename _Tp> + struct __is_constructible_impl<_Tp> + : public is_default_constructible<_Tp> + { }; /// is_constructible - // XXX FIXME - // The C++0x specifications require front-end support, see N2255. template<typename _Tp, typename... _Args> struct is_constructible - : public integral_constant<bool, - __is_constructible_helper<_Tp, - _Args...>::__value> + : public integral_constant<bool, (__is_constructible_impl<_Tp, + _Args...>::value)> { }; + template<bool, typename _Tp, typename... _Args> struct __is_nt_constructible_helper { static const bool __value = false; }; @@ -750,7 +919,63 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, __has_nothrow_assign(_Tp)> { }; - // Relationships between types. + /// has_virtual_destructor + template<typename _Tp> + struct has_virtual_destructor + : public integral_constant<bool, __has_virtual_destructor(_Tp)> + { }; + + + // type property queries. + + /// alignment_of + template<typename _Tp> + struct alignment_of + : public integral_constant<std::size_t, __alignof__(_Tp)> { }; + + /// rank + template<typename> + struct rank + : public integral_constant<std::size_t, 0> { }; + + template<typename _Tp, std::size_t _Size> + struct rank<_Tp[_Size]> + : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; + + template<typename _Tp> + struct rank<_Tp[]> + : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; + + /// extent + template<typename, unsigned _Uint> + struct extent + : public integral_constant<std::size_t, 0> { }; + + template<typename _Tp, unsigned _Uint, std::size_t _Size> + struct extent<_Tp[_Size], _Uint> + : public integral_constant<std::size_t, + _Uint == 0 ? _Size : extent<_Tp, + _Uint - 1>::value> + { }; + + template<typename _Tp, unsigned _Uint> + struct extent<_Tp[], _Uint> + : public integral_constant<std::size_t, + _Uint == 0 ? 0 : extent<_Tp, + _Uint - 1>::value> + { }; + + + // type relations. + + /// is_same + template<typename, typename> + struct is_same + : public false_type { }; + + template<typename _Tp> + struct is_same<_Tp, _Tp> + : public true_type { }; /// is_base_of template<typename _Base, typename _Derived> @@ -759,8 +984,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; template<typename _From, typename _To, - bool = (is_void<_From>::value || is_function<_To>::value - || is_array<_To>::value)> + bool = __or_<is_void<_From>, is_function<_To>, + is_array<_To>>::value> struct __is_convertible_helper { static const bool __value = is_void<_To>::value; }; @@ -783,8 +1008,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; /// is_convertible - // XXX FIXME - // The C++0x specifications require front-end support, see N2255. template<typename _From, typename _To> struct is_convertible : public integral_constant<bool, @@ -797,123 +1020,108 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public is_constructible<_To, _From> { }; - template<std::size_t _Len> - struct __aligned_storage_msa - { - union __type - { - unsigned char __data[_Len]; - struct __attribute__((__aligned__)) { } __align; - }; - }; - /** - * @brief Alignment type. - * - * The value of _Align is a default-alignment which shall be the - * most stringent alignment requirement for any C++ object type - * whose size is no greater than _Len (3.9). The member typedef - * type shall be a POD type suitable for use as uninitialized - * storage for any object whose size is at most _Len and whose - * alignment is a divisor of _Align. - */ - template<std::size_t _Len, std::size_t _Align = - __alignof__(typename __aligned_storage_msa<_Len>::__type)> - struct aligned_storage - { - union type - { - unsigned char __data[_Len]; - struct __attribute__((__aligned__((_Align)))) { } __align; - }; - }; + // const-volatile modifications. - - // Define a nested type if some predicate holds. - // Primary template. - /// enable_if - template<bool, typename _Tp = void> - struct enable_if - { }; - - // Partial specialization for true. + /// remove_const template<typename _Tp> - struct enable_if<true, _Tp> - { typedef _Tp type; }; - + struct remove_const + { typedef _Tp type; }; - // A conditional expression, but for types. If true, first, if false, second. - // Primary template. - /// conditional - template<bool _Cond, typename _Iftrue, typename _Iffalse> - struct conditional - { typedef _Iftrue type; }; + template<typename _Tp> + struct remove_const<_Tp const> + { typedef _Tp type; }; + + /// remove_volatile + template<typename _Tp> + struct remove_volatile + { typedef _Tp type; }; - // Partial specialization for false. - template<typename _Iftrue, typename _Iffalse> - struct conditional<false, _Iftrue, _Iffalse> - { typedef _Iffalse type; }; + template<typename _Tp> + struct remove_volatile<_Tp volatile> + { typedef _Tp type; }; + + /// remove_cv + template<typename _Tp> + struct remove_cv + { + typedef typename + remove_const<typename remove_volatile<_Tp>::type>::type type; + }; + + /// add_const + template<typename _Tp> + struct add_const + { typedef _Tp const type; }; + + /// add_volatile + template<typename _Tp> + struct add_volatile + { typedef _Tp volatile type; }; + + /// add_cv + template<typename _Tp> + struct add_cv + { + typedef typename + add_const<typename add_volatile<_Tp>::type>::type type; + }; - // Decay trait for arrays and functions, used for perfect forwarding - // in make_pair, make_tuple, etc. - template<typename _Up, - bool _IsArray = is_array<_Up>::value, - bool _IsFunction = is_function<_Up>::value> - struct __decay_selector; - - // NB: DR 705. - template<typename _Up> - struct __decay_selector<_Up, false, false> - { typedef typename remove_cv<_Up>::type __type; }; + // Reference transformations. - template<typename _Up> - struct __decay_selector<_Up, true, false> - { typedef typename remove_extent<_Up>::type* __type; }; + /// remove_reference + template<typename _Tp> + struct remove_reference + { typedef _Tp type; }; - template<typename _Up> - struct __decay_selector<_Up, false, true> - { typedef typename add_pointer<_Up>::type __type; }; + template<typename _Tp> + struct remove_reference<_Tp&> + { typedef _Tp type; }; - /// decay - template<typename _Tp> - class decay - { - typedef typename remove_reference<_Tp>::type __remove_type; + template<typename _Tp> + struct remove_reference<_Tp&&> + { typedef _Tp type; }; - public: - typedef typename __decay_selector<__remove_type>::__type type; - }; + template<typename _Tp, + bool = __and_<__not_<is_reference<_Tp>>, + __not_<is_void<_Tp>>>::value, + bool = is_rvalue_reference<_Tp>::value> + struct __add_lvalue_reference_helper + { typedef _Tp type; }; template<typename _Tp> - class reference_wrapper; + struct __add_lvalue_reference_helper<_Tp, true, false> + { typedef _Tp& type; }; - // Helper which adds a reference to a type when given a reference_wrapper template<typename _Tp> - struct __strip_reference_wrapper - { - typedef _Tp __type; - }; + struct __add_lvalue_reference_helper<_Tp, false, true> + { typedef typename remove_reference<_Tp>::type& type; }; + /// add_lvalue_reference template<typename _Tp> - struct __strip_reference_wrapper<reference_wrapper<_Tp> > - { - typedef _Tp& __type; - }; + struct add_lvalue_reference + : public __add_lvalue_reference_helper<_Tp> + { }; + + template<typename _Tp, + bool = __and_<__not_<is_reference<_Tp>>, + __not_<is_void<_Tp>>>::value> + struct __add_rvalue_reference_helper + { typedef _Tp type; }; template<typename _Tp> - struct __strip_reference_wrapper<const reference_wrapper<_Tp> > - { - typedef _Tp& __type; - }; + struct __add_rvalue_reference_helper<_Tp, true> + { typedef _Tp&& type; }; + /// add_rvalue_reference template<typename _Tp> - struct __decay_and_strip - { - typedef typename __strip_reference_wrapper< - typename decay<_Tp>::type>::__type __type; - }; + struct add_rvalue_reference + : public __add_rvalue_reference_helper<_Tp> + { }; + + // sign modifications. // Utility for constructing identically cv-qualified types. template<typename _Unqualified, bool _IsConst, bool _IsVol> @@ -946,7 +1154,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename __match::__type __type; }; - // Utility for finding the unsigned versions of signed integral types. template<typename _Tp> struct __make_unsigned @@ -976,7 +1183,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __make_unsigned<long long> { typedef unsigned long long __type; }; - // Select between integral and enum: not possible to be both. template<typename _Tp, bool _IsInt = is_integral<_Tp>::value, @@ -1053,7 +1259,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __make_signed<unsigned long long> { typedef signed long long __type; }; - // Select between integral and enum: not possible to be both. template<typename _Tp, bool _IsInt = is_integral<_Tp>::value, @@ -1100,6 +1305,176 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> struct make_signed<bool>; + + // array modifications. + + /// remove_extent + template<typename _Tp> + struct remove_extent + { typedef _Tp type; }; + + template<typename _Tp, std::size_t _Size> + struct remove_extent<_Tp[_Size]> + { typedef _Tp type; }; + + template<typename _Tp> + struct remove_extent<_Tp[]> + { typedef _Tp type; }; + + /// remove_all_extents + template<typename _Tp> + struct remove_all_extents + { typedef _Tp type; }; + + template<typename _Tp, std::size_t _Size> + struct remove_all_extents<_Tp[_Size]> + { typedef typename remove_all_extents<_Tp>::type type; }; + + template<typename _Tp> + struct remove_all_extents<_Tp[]> + { typedef typename remove_all_extents<_Tp>::type type; }; + + + // pointer modifications. + + template<typename _Tp, typename> + struct __remove_pointer_helper + { typedef _Tp type; }; + + template<typename _Tp, typename _Up> + struct __remove_pointer_helper<_Tp, _Up*> + { typedef _Up type; }; + + /// remove_pointer + template<typename _Tp> + struct remove_pointer + : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> + { }; + + /// add_pointer + template<typename _Tp> + struct add_pointer + { typedef typename remove_reference<_Tp>::type* type; }; + + + template<std::size_t _Len> + struct __aligned_storage_msa + { + union __type + { + unsigned char __data[_Len]; + struct __attribute__((__aligned__)) { } __align; + }; + }; + + /** + * @brief Alignment type. + * + * The value of _Align is a default-alignment which shall be the + * most stringent alignment requirement for any C++ object type + * whose size is no greater than _Len (3.9). The member typedef + * type shall be a POD type suitable for use as uninitialized + * storage for any object whose size is at most _Len and whose + * alignment is a divisor of _Align. + */ + template<std::size_t _Len, std::size_t _Align = + __alignof__(typename __aligned_storage_msa<_Len>::__type)> + struct aligned_storage + { + union type + { + unsigned char __data[_Len]; + struct __attribute__((__aligned__((_Align)))) { } __align; + }; + }; + + + // Decay trait for arrays and functions, used for perfect forwarding + // in make_pair, make_tuple, etc. + template<typename _Up, + bool _IsArray = is_array<_Up>::value, + bool _IsFunction = is_function<_Up>::value> + struct __decay_selector; + + // NB: DR 705. + template<typename _Up> + struct __decay_selector<_Up, false, false> + { typedef typename remove_cv<_Up>::type __type; }; + + template<typename _Up> + struct __decay_selector<_Up, true, false> + { typedef typename remove_extent<_Up>::type* __type; }; + + template<typename _Up> + struct __decay_selector<_Up, false, true> + { typedef typename add_pointer<_Up>::type __type; }; + + /// decay + template<typename _Tp> + class decay + { + typedef typename remove_reference<_Tp>::type __remove_type; + + public: + typedef typename __decay_selector<__remove_type>::__type type; + }; + + template<typename _Tp> + class reference_wrapper; + + // Helper which adds a reference to a type when given a reference_wrapper + template<typename _Tp> + struct __strip_reference_wrapper + { + typedef _Tp __type; + }; + + template<typename _Tp> + struct __strip_reference_wrapper<reference_wrapper<_Tp> > + { + typedef _Tp& __type; + }; + + template<typename _Tp> + struct __strip_reference_wrapper<const reference_wrapper<_Tp> > + { + typedef _Tp& __type; + }; + + template<typename _Tp> + struct __decay_and_strip + { + typedef typename __strip_reference_wrapper< + typename decay<_Tp>::type>::__type __type; + }; + + + // Define a nested type if some predicate holds. + // Primary template. + /// enable_if + template<bool, typename _Tp = void> + struct enable_if + { }; + + // Partial specialization for true. + template<typename _Tp> + struct enable_if<true, _Tp> + { typedef _Tp type; }; + + + // A conditional expression, but for types. If true, first, if false, second. + // Primary template. + /// conditional + template<bool _Cond, typename _Iftrue, typename _Iffalse> + struct conditional + { typedef _Iftrue type; }; + + // Partial specialization for false. + template<typename _Iftrue, typename _Iffalse> + struct conditional<false, _Iftrue, _Iffalse> + { typedef _Iffalse type; }; + + /// common_type template<typename... _Tp> struct common_type; @@ -1119,6 +1494,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; }; + /// underlying_type (still unimplemented) + + /// result_of + template<typename _Signature> + class result_of; + + template<typename _Functor, typename... _ArgTypes> + struct result_of<_Functor(_ArgTypes...)> + { + typedef + decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) ) + type; + }; + /// declval template<typename _Tp> struct __declval_protector @@ -1136,18 +1525,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __declval_protector<_Tp>::__delegate(); } - /// result_of - template<typename _Signature> - class result_of; - - template<typename _Functor, typename... _ArgTypes> - struct result_of<_Functor(_ArgTypes...)> - { - typedef - decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) ) - type; - }; - /** * Use SFINAE to determine if the type _Tp has a publicly-accessible * member type _NTYPE. @@ -1177,11 +1554,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION <typename remove_cv<_Tp>::type>::value> \ { }; -#undef _DEFINE_SPEC_0_HELPER -#undef _DEFINE_SPEC_1_HELPER -#undef _DEFINE_SPEC_2_HELPER -#undef _DEFINE_SPEC - // @} group metaprogramming _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index 9113c03..aaf1fb0 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 1134 } +// { dg-error "static assertion failed" "" { target *-*-* } 1523 } #include <utility> diff --git a/libstdc++-v3/testsuite/20_util/is_compound/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_compound/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..efa2b85 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_compound/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_compound<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_compound/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_compound/requirements/typedefs.cc new file mode 100644 index 0000000..c167b16 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_compound/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_compound<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_compound/value.cc b/libstdc++-v3/testsuite/20_util/is_compound/value.cc new file mode 100644 index 0000000..053983a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_compound/value.cc @@ -0,0 +1,57 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_compound; + using namespace __gnu_test; + + VERIFY( (test_category<is_compound, void>(false)) ); + VERIFY( (test_category<is_compound, char>(false)) ); + VERIFY( (test_category<is_compound, signed char>(false)) ); + VERIFY( (test_category<is_compound, unsigned char>(false)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_compound, wchar_t>(false)) ); +#endif + VERIFY( (test_category<is_compound, short>(false)) ); + VERIFY( (test_category<is_compound, unsigned short>(false)) ); + VERIFY( (test_category<is_compound, int>(false)) ); + VERIFY( (test_category<is_compound, unsigned int>(false)) ); + VERIFY( (test_category<is_compound, long>(false)) ); + VERIFY( (test_category<is_compound, unsigned long>(false)) ); + VERIFY( (test_category<is_compound, long long>(false)) ); + VERIFY( (test_category<is_compound, unsigned long long>(false)) ); + VERIFY( (test_category<is_compound, float>(false)) ); + VERIFY( (test_category<is_compound, double>(false)) ); + VERIFY( (test_category<is_compound, long double>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_compound, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc b/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc new file mode 100644 index 0000000..9e4bd97 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc @@ -0,0 +1,819 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <initializer_list> +#include <testsuite_tr1.h> + +using namespace __gnu_test::construct_destruct; + +static_assert(std::is_constructible<int, int>::value, "Error"); +static_assert(std::is_constructible<std::nullptr_t, std::nullptr_t>::value, + "Error"); +static_assert(std::is_constructible<E, E>::value, "Error"); +static_assert(std::is_constructible<SE, SE>::value, "Error"); +static_assert(std::is_constructible<OpE, OpE>::value, "Error"); +static_assert(std::is_constructible<OpSE, OpSE>::value, "Error"); +static_assert(std::is_constructible<Empty, Empty>::value, "Error"); +static_assert(std::is_constructible<B, B>::value, "Error"); +static_assert(std::is_constructible<U, U>::value, "Error"); +static_assert(std::is_constructible<int B::*, int B::*>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, Ellipsis>::value, "Error"); +static_assert(std::is_constructible<int*, int*>::value, "Error"); +static_assert(std::is_constructible<void*, void*>::value, "Error"); +static_assert(std::is_constructible<Any, Any>::value, "Error"); +static_assert(std::is_constructible<nAny, nAny>::value, "Error"); +static_assert(std::is_constructible<std::initializer_list<int>, + std::initializer_list<int>>::value, "Error"); +static_assert(std::is_constructible<DelDef, DelDef>::value, "Error"); + +static_assert(!std::is_constructible<void, void>::value, "Error"); +static_assert(!std::is_constructible<Abstract, Abstract>::value, "Error"); +static_assert(!std::is_constructible<int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<int[1], int[1]>::value, "Error"); +static_assert(!std::is_constructible<DelCopy, const DelCopy&>::value, "Error"); +static_assert(!std::is_constructible<DelCopy, DelCopy&&>::value, "Error"); +static_assert(!std::is_constructible<DelCopy, DelCopy>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, void>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, int>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, DelDtor>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, DelDtor&&>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, const DelDtor&>::value, "Error"); + +static_assert(std::is_constructible<DelEllipsis, const DelEllipsis&>::value, + "Error"); +static_assert(std::is_constructible<DelEllipsis, DelEllipsis&&>::value, + "Error"); +static_assert(std::is_constructible<DelEllipsis, DelEllipsis>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, void>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, std::nullptr_t>::value, + "Error"); +static_assert(!std::is_constructible<DelEllipsis, B>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, Empty>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, E>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, SE>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, OpE>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, OpSE>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, void()>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, void() const>::value, + "Error"); +static_assert(!std::is_constructible<DelEllipsis, int[1]>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, int[]>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, int*>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, void*>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, int B::*>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, int D::*>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, Abstract>::value, "Error"); +static_assert(!std::is_constructible<int, DelImplicitTo<int>>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, + DelImplicitTo<std::nullptr_t>>::value, "Error"); +static_assert(!std::is_constructible<int&, + DelImplicitTo<const int&>>::value, "Error"); + +static_assert(!std::is_constructible<int, void>::value, "Error"); +static_assert(!std::is_constructible<void, int>::value, "Error"); +static_assert(std::is_constructible<void*, int*>::value, "Error"); +static_assert(!std::is_constructible<int*, void*>::value, "Error"); +static_assert(std::is_constructible<int*, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, int*>::value, "Error"); +static_assert(!std::is_constructible<Empty, E>::value, "Error"); +static_assert(!std::is_constructible<Empty, SE>::value, "Error"); +static_assert(!std::is_constructible<Empty, OpE>::value, "Error"); +static_assert(!std::is_constructible<Empty, OpSE>::value, "Error"); +static_assert(!std::is_constructible<Empty, void>::value, "Error"); +static_assert(!std::is_constructible<Empty, void*>::value, "Error"); +static_assert(!std::is_constructible<Empty, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<Empty, int[]>::value, "Error"); +static_assert(!std::is_constructible<Empty, int[3]>::value, "Error"); +static_assert(!std::is_constructible<Empty, int>::value, "Error"); +static_assert(!std::is_constructible<Abstract, int>::value, "Error"); +static_assert(!std::is_constructible<Abstract, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, Abstract>::value, "Error"); +static_assert(!std::is_constructible<Abstract, int[]>::value, "Error"); +static_assert(std::is_constructible<B, D>::value, "Error"); +static_assert(!std::is_constructible<D, B>::value, "Error"); +static_assert(!std::is_constructible<int[], int[1]>::value, "Error"); +static_assert(!std::is_constructible<int[1], int[]>::value, "Error"); +static_assert(!std::is_constructible<int[], Empty>::value, "Error"); +static_assert(!std::is_constructible<int[], std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<int[1], Abstract>::value, "Error"); + +static_assert(std::is_constructible<const int*, int*>::value, "Error"); +static_assert(std::is_constructible<const void*, void*>::value, "Error"); +static_assert(std::is_constructible<const void*, int*>::value, "Error"); +static_assert(!std::is_constructible<int*, const void*>::value, "Error"); + +static_assert(std::is_constructible<int, E>::value, "Error"); +static_assert(!std::is_constructible<E, int>::value, "Error"); +static_assert(!std::is_constructible<E, E2>::value, "Error"); +static_assert(std::is_constructible<E, E>::value, "Error"); +static_assert(std::is_constructible<bool, E>::value, "Error"); +static_assert(!std::is_constructible<E, bool>::value, "Error"); +static_assert(std::is_constructible<double, E>::value, "Error"); +static_assert(!std::is_constructible<E, double>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, E>::value, "Error"); +static_assert(!std::is_constructible<E, std::nullptr_t>::value, "Error"); + +static_assert(std::is_constructible<int, OpE>::value, "Error"); +static_assert(!std::is_constructible<OpE, int>::value, "Error"); +static_assert(!std::is_constructible<OpE, E2>::value, "Error"); +static_assert(std::is_constructible<OpE, OpE>::value, "Error"); +static_assert(std::is_constructible<bool, OpE>::value, "Error"); +static_assert(!std::is_constructible<OpE, bool>::value, "Error"); +static_assert(std::is_constructible<double, OpE>::value, "Error"); +static_assert(!std::is_constructible<OpE, double>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, OpE>::value, "Error"); +static_assert(!std::is_constructible<OpE, std::nullptr_t>::value, "Error"); + +static_assert(!std::is_constructible<int, SE>::value, "Error"); +static_assert(!std::is_constructible<SE, int>::value, "Error"); +static_assert(!std::is_constructible<E, SE>::value, "Error"); +static_assert(!std::is_constructible<SE, SE2>::value, "Error"); +static_assert(std::is_constructible<SE, SE>::value, "Error"); +static_assert(!std::is_constructible<bool, SE>::value, "Error"); +static_assert(!std::is_constructible<SE, bool>::value, "Error"); +static_assert(!std::is_constructible<double, SE>::value, "Error"); +static_assert(!std::is_constructible<SE, double>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, SE>::value, "Error"); +static_assert(!std::is_constructible<SE, std::nullptr_t>::value, "Error"); + +static_assert(!std::is_constructible<int, OpSE>::value, "Error"); +static_assert(!std::is_constructible<OpSE, int>::value, "Error"); +static_assert(!std::is_constructible<OpE, OpSE>::value, "Error"); +static_assert(!std::is_constructible<OpSE, SE2>::value, "Error"); +static_assert(std::is_constructible<OpSE, OpSE>::value, "Error"); +static_assert(!std::is_constructible<bool, OpSE>::value, "Error"); +static_assert(!std::is_constructible<OpSE, bool>::value, "Error"); +static_assert(!std::is_constructible<double, OpSE>::value, "Error"); +static_assert(!std::is_constructible<OpSE, double>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, OpSE>::value, "Error"); +static_assert(!std::is_constructible<OpSE, std::nullptr_t>::value, "Error"); + +static_assert(!std::is_constructible<D*, B*>::value, "Error"); +static_assert(!std::is_constructible<const volatile D*, B*>::value, "Error"); +static_assert(!std::is_constructible<D*, const volatile B*>::value, "Error"); + +static_assert(!std::is_constructible<D*, B* const>::value, "Error"); +static_assert(!std::is_constructible<const volatile D*, B* const>::value, + "Error"); +static_assert(!std::is_constructible<D*, const volatile B* const>::value, + "Error"); + +static_assert(!std::is_constructible<D*, B*&>::value, "Error"); +static_assert(!std::is_constructible<const volatile D*, B*&>::value, "Error"); +static_assert(!std::is_constructible<D*, const volatile B*&>::value, "Error"); + +static_assert(!std::is_constructible<int B::*, int D::*>::value, "Error"); +static_assert(!std::is_constructible<const volatile int B::*, int D::*>::value, + "Error"); +static_assert(!std::is_constructible<int B::*, const volatile int D::*>::value, + "Error"); + +static_assert(!std::is_constructible<int B::*, int D::* const>::value, "Error"); +static_assert(!std::is_constructible<const volatile int B::*, + int D::* const>::value, "Error"); +static_assert(!std::is_constructible<int B::*, + const volatile int D::* const>::value, "Error"); + +static_assert(!std::is_constructible<int B::*, int D::*&>::value, "Error"); +static_assert(!std::is_constructible<const volatile int B::*, + int D::*&>::value, "Error"); +static_assert(!std::is_constructible<int B::*, + const volatile int D::*&>::value, "Error"); + +static_assert(!std::is_constructible<int B::*, int D::* const &>::value, + "Error"); +static_assert(!std::is_constructible<const volatile int B::*, + int D::* const &>::value, "Error"); +static_assert(!std::is_constructible<int B::*, + const volatile int D::* const &>::value, "Error"); + +static_assert(!std::is_constructible<int&&, int&>::value, "Error"); +static_assert(!std::is_constructible<const int&&, int&>::value, "Error"); + +static_assert(std::is_constructible<B&, D&>::value, "Error"); +static_assert(std::is_constructible<B&&, D&&>::value, "Error"); +static_assert(std::is_constructible<const B&, D&>::value, "Error"); +static_assert(std::is_constructible<const B&&, D&&>::value, "Error"); +static_assert(!std::is_constructible<B&, const D&>::value, "Error"); +static_assert(!std::is_constructible<B&&, const D&&>::value, "Error"); + +static_assert(!std::is_constructible<D&, B&>::value, "Error"); +static_assert(!std::is_constructible<D&&, B&&>::value, "Error"); +static_assert(!std::is_constructible<D&, const B&>::value, "Error"); +static_assert(!std::is_constructible<D&&, const B&&>::value, "Error"); +static_assert(!std::is_constructible<const D&, B&>::value, "Error"); +static_assert(!std::is_constructible<const D&&, B&&>::value, "Error"); + +static_assert(!std::is_constructible<B&&, B&>::value, "Error"); +static_assert(!std::is_constructible<B&&, D&>::value, "Error"); +static_assert(std::is_constructible<B&&, ImplicitTo<D&&>>::value, "Error"); +static_assert(std::is_constructible<B&&, ImplicitTo<D&&>&>::value, "Error"); +static_assert(std::is_constructible<int&&, double&>::value, "Error"); +static_assert(std::is_constructible<const int&, + ImplicitTo<int&>&>::value, "Error"); +static_assert(std::is_constructible<const int&, + ImplicitTo<int&>>::value, "Error"); +static_assert(std::is_constructible<const int&, + ExplicitTo<int&>&>::value, "Error"); +static_assert(std::is_constructible<const int&, + ExplicitTo<int&>>::value, "Error"); + +static_assert(std::is_constructible<B&&, ExplicitTo<D&&>>::value, "Error"); +static_assert(std::is_constructible<B&&, ExplicitTo<D&&>&>::value, "Error"); + +static_assert(!std::is_constructible<B&, B&&>::value, "Error"); +static_assert(!std::is_constructible<D&, B&&>::value, "Error"); +static_assert(!std::is_constructible<B&, D&&>::value, "Error"); + +static_assert(std::is_constructible<void(&)(), void(&)()>::value, "Error"); +static_assert(std::is_constructible<void(&&)(), void(&&)()>::value, "Error"); +static_assert(std::is_constructible<void(&&)(), void()>::value, "Error"); + +static_assert(!std::is_constructible<void>::value, "Error" ); +static_assert(!std::is_constructible<void, int>::value, "Error" ); +static_assert(!std::is_constructible<void, int, double>::value, "Error" ); + +static_assert(!std::is_constructible<int&>::value, "Error" ); +static_assert(!std::is_constructible<const int&>::value, "Error" ); +static_assert(!std::is_constructible<int&, int, int>::value, "Error" ); +static_assert(!std::is_constructible<const int&, int, int>::value, "Error" ); + +static_assert(std::is_constructible<void(&)(), void()>::value, "Error"); +static_assert(std::is_constructible<void(&)(), void(&&)()>::value, "Error"); + +static_assert(std::is_constructible<int&, int&>::value, "Error"); +static_assert(!std::is_constructible<int&, const int&>::value, "Error"); +static_assert(!std::is_constructible<int&, int>::value, "Error"); +static_assert(!std::is_constructible<int&, int&&>::value, "Error"); +static_assert(!std::is_constructible<int&, const int&&>::value, "Error"); +static_assert(std::is_constructible<const int&, int&>::value, "Error"); +static_assert(std::is_constructible<const int&, int>::value, "Error"); +static_assert(std::is_constructible<const int&, const int>::value, "Error"); +static_assert(std::is_constructible<const int&, int&&>::value, "Error"); +static_assert(std::is_constructible<const int&, const int&&>::value, "Error"); +static_assert(std::is_constructible<volatile int&, int&>::value, "Error"); +static_assert(!std::is_constructible<volatile int&, const int&>::value, + "Error"); +static_assert(!std::is_constructible<volatile int&, int>::value, "Error"); +static_assert(!std::is_constructible<volatile int&, int&&>::value, "Error"); +static_assert(!std::is_constructible<volatile int&, const int&&>::value, + "Error"); +static_assert(std::is_constructible<const volatile int&, int&>::value, "Error"); +static_assert(!std::is_constructible<const volatile int&, int>::value, "Error"); +static_assert(!std::is_constructible<const volatile int&, const int>::value, + "Error"); +static_assert(!std::is_constructible<const volatile int&, int&&>::value, + "Error"); +static_assert(!std::is_constructible<const volatile int&, const int&&>::value, + "Error"); + +static_assert(std::is_constructible<int&&, int>::value, "Error"); +static_assert(std::is_constructible<int&&, int&&>::value, "Error"); +static_assert(!std::is_constructible<int&&, const int&&>::value, "Error"); +static_assert(!std::is_constructible<int&&, int&>::value, "Error"); +static_assert(!std::is_constructible<int&&, const int&>::value, "Error"); +static_assert(std::is_constructible<int&&, double&>::value, "Error"); +static_assert(std::is_constructible<const int&&, int>::value, "Error"); +static_assert(std::is_constructible<const int&&, int&&>::value, "Error"); +static_assert(std::is_constructible<const int&&, const int>::value, "Error"); +static_assert(std::is_constructible<const int&&, const int&&>::value, "Error"); +static_assert(!std::is_constructible<int&&, const int&>::value, "Error"); +static_assert(!std::is_constructible<const int&&, int&>::value, "Error"); +static_assert(!std::is_constructible<const int&&, const int&>::value, "Error"); +static_assert(std::is_constructible<volatile int&&, int>::value, "Error"); +static_assert(std::is_constructible<volatile int&&, int&&>::value, "Error"); +static_assert(!std::is_constructible<volatile int&&, const int&&>::value, + "Error"); +static_assert(!std::is_constructible<volatile int&&, int&>::value, "Error"); +static_assert(!std::is_constructible<volatile int&&, const int&>::value, + "Error"); +static_assert(std::is_constructible<volatile int&&, double&>::value, "Error"); +static_assert(std::is_constructible<volatile const int&&, int>::value, "Error"); +static_assert(std::is_constructible<const volatile int&&, int&&>::value, + "Error"); +static_assert(std::is_constructible<const volatile int&&, const int>::value, + "Error"); +static_assert(std::is_constructible<const volatile int&&, const int&&>::value, + "Error"); +static_assert(!std::is_constructible<volatile int&&, const int&>::value, + "Error"); +static_assert(!std::is_constructible<const volatile int&&, int&>::value, + "Error"); +static_assert(!std::is_constructible<const volatile int&&, + const int&>::value, "Error"); + +static_assert(std::is_constructible<Empty&, Empty&>::value, "Error"); +static_assert(!std::is_constructible<Empty&, const Empty&>::value, "Error"); +static_assert(!std::is_constructible<Empty&, Empty>::value, "Error"); +static_assert(!std::is_constructible<Empty&, Empty&&>::value, "Error"); +static_assert(!std::is_constructible<Empty&, const Empty&&>::value, "Error"); +static_assert(std::is_constructible<const Empty&, Empty&>::value, "Error"); +static_assert(std::is_constructible<const Empty&, Empty>::value, "Error"); +static_assert(std::is_constructible<const Empty&, const Empty>::value, "Error"); +static_assert(std::is_constructible<const Empty&, Empty&&>::value, "Error"); +static_assert(std::is_constructible<const Empty&, const Empty&&>::value, + "Error"); +static_assert(std::is_constructible<volatile Empty&, Empty&>::value, "Error"); +static_assert(!std::is_constructible<volatile Empty&, const Empty&>::value, + "Error"); +static_assert(!std::is_constructible<volatile Empty&, Empty>::value, "Error"); +static_assert(!std::is_constructible<volatile Empty&, Empty&&>::value, "Error"); +static_assert(!std::is_constructible<volatile Empty&, const Empty&&>::value, + "Error"); +static_assert(std::is_constructible<const volatile Empty&, Empty&>::value, + "Error"); +static_assert(!std::is_constructible<const volatile Empty&, Empty>::value, + "Error"); +static_assert(!std::is_constructible<const volatile Empty&, + const Empty>::value, "Error"); +static_assert(!std::is_constructible<const volatile Empty&, + Empty&&>::value, "Error"); +static_assert(!std::is_constructible<const volatile Empty&, + const Empty&&>::value, "Error"); + +static_assert(std::is_constructible<Empty&&, Empty>::value, "Error"); +static_assert(std::is_constructible<Empty&&, Empty&&>::value, "Error"); +static_assert(!std::is_constructible<Empty&&, const Empty&&>::value, "Error"); +static_assert(!std::is_constructible<Empty&&, Empty&>::value, "Error"); +static_assert(!std::is_constructible<Empty&&, const Empty&>::value, "Error"); +static_assert(!std::is_constructible<Empty&&, double&>::value, "Error"); +static_assert(!std::is_constructible<Empty&&, const double&>::value, "Error"); +static_assert(std::is_constructible<const Empty&&, Empty>::value, "Error"); +static_assert(std::is_constructible<const Empty&&, Empty&&>::value, "Error"); +static_assert(std::is_constructible<const Empty&&, const Empty>::value, + "Error"); +static_assert(std::is_constructible<const Empty&&, const Empty&&>::value, + "Error"); +static_assert(!std::is_constructible<Empty&&, const Empty&>::value, "Error"); +static_assert(!std::is_constructible<const Empty&&, Empty&>::value, "Error"); +static_assert(!std::is_constructible<const Empty&&, const Empty&>::value, + "Error"); +static_assert(std::is_constructible<volatile Empty&&, Empty>::value, "Error"); +static_assert(std::is_constructible<volatile Empty&&, Empty&&>::value, "Error"); +static_assert(!std::is_constructible<volatile Empty&&, const Empty&&>::value, + "Error"); +static_assert(!std::is_constructible<volatile Empty&&, Empty&>::value, "Error"); +static_assert(!std::is_constructible<volatile Empty&&, const Empty&>::value, + "Error"); +static_assert(!std::is_constructible<volatile Empty&&, double&>::value, + "Error"); +static_assert(!std::is_constructible<volatile Empty&&, const double&>::value, + "Error"); +static_assert(std::is_constructible<const volatile Empty&&, Empty>::value, + "Error"); +static_assert(std::is_constructible<const volatile Empty&&, Empty&&>::value, + "Error"); +static_assert(std::is_constructible<const volatile Empty&&, + const Empty>::value, "Error"); +static_assert(std::is_constructible<const volatile Empty&&, + const Empty&&>::value, "Error"); +static_assert(!std::is_constructible<volatile Empty&&, + const Empty&>::value, "Error"); +static_assert(!std::is_constructible<const volatile Empty&&, + Empty&>::value, "Error"); +static_assert(!std::is_constructible<const volatile Empty&&, + const Empty&>::value, "Error"); + +static_assert(std::is_constructible<Ellipsis, int>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, Empty>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, std::nullptr_t>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, int[]>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, int[1]>::value, "Error"); +static_assert(!std::is_constructible<Ellipsis, void>::value, "Error"); + +static_assert(std::is_constructible<int(&)[1], int(&)[1]>::value, "Error"); +static_assert(std::is_constructible<const int(&)[1], + int(&)[1]>::value, "Error"); +static_assert(std::is_constructible<volatile int(&)[1], + int(&)[1]>::value, "Error"); +static_assert(std::is_constructible<const volatile int(&)[1], + int(&)[1]>::value, "Error"); +static_assert(!std::is_constructible<int(&)[1], + const int(&)[1]>::value, "Error"); +static_assert(!std::is_constructible<const int(&)[1], + volatile int(&)[1]>::value, "Error"); + +static_assert(std::is_constructible<int(&)[], int(&)[]>::value, "Error"); + +static_assert(!std::is_constructible<int(&)[1], int(&)[2]>::value, "Error"); +static_assert(!std::is_constructible<int(&)[1], int&>::value, "Error"); +static_assert(!std::is_constructible<int&, int(&)[1]>::value, "Error"); + +static_assert(!std::is_constructible<U, int>::value, "Error"); +static_assert(!std::is_constructible<U, Empty>::value, "Error"); + +static_assert(!std::is_constructible<void(), void()>::value, "Error"); +static_assert(!std::is_constructible<void(), int>::value, "Error"); +static_assert(!std::is_constructible<void(), Abstract>::value, "Error"); +static_assert(!std::is_constructible<void(), std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<void(), Empty>::value, "Error"); +static_assert(!std::is_constructible<void(), U>::value, "Error"); +static_assert(!std::is_constructible<void(), E>::value, "Error"); +static_assert(!std::is_constructible<void(), SE>::value, "Error"); +static_assert(!std::is_constructible<void(), OpE>::value, "Error"); +static_assert(!std::is_constructible<void(), OpSE>::value, "Error"); +static_assert(!std::is_constructible<void(), int[]>::value, "Error"); +static_assert(!std::is_constructible<void(), int[1]>::value, "Error"); + +static_assert(!std::is_constructible<void() const, + void() volatile>::value, "Error"); +static_assert(!std::is_constructible<void() const, int>::value, "Error"); +static_assert(!std::is_constructible<void() const, Abstract>::value, "Error"); +static_assert(!std::is_constructible<void() const, std::nullptr_t>::value, + "Error"); +static_assert(!std::is_constructible<void() const, Empty>::value, "Error"); +static_assert(!std::is_constructible<void() const, U>::value, "Error"); +static_assert(!std::is_constructible<void() const, E>::value, "Error"); +static_assert(!std::is_constructible<void() const, SE>::value, "Error"); +static_assert(!std::is_constructible<void() const, OpE>::value, "Error"); +static_assert(!std::is_constructible<void() const, OpSE>::value, "Error"); +static_assert(!std::is_constructible<void() const, int[]>::value, "Error"); +static_assert(!std::is_constructible<void() const, int[1]>::value, "Error"); + +static_assert(!std::is_constructible<void(int), void()>::value, "Error"); +static_assert(!std::is_constructible<int, void()>::value, "Error"); +static_assert(!std::is_constructible<Abstract, void()>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, void()>::value, "Error"); +static_assert(!std::is_constructible<Empty, void()>::value, "Error"); +static_assert(!std::is_constructible<U, void()>::value, "Error"); +static_assert(!std::is_constructible<E, void()>::value, "Error"); +static_assert(!std::is_constructible<SE, void()>::value, "Error"); +static_assert(!std::is_constructible<OpE, void()>::value, "Error"); +static_assert(!std::is_constructible<OpSE, void()>::value, "Error"); +static_assert(!std::is_constructible<int[], void()>::value, "Error"); +static_assert(!std::is_constructible<int[1], void()>::value, "Error"); + +static_assert(!std::is_constructible<void(int) const, + void() const>::value, "Error"); +static_assert(!std::is_constructible<int, void() const>::value, "Error"); +static_assert(!std::is_constructible<Abstract, void() const>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, void() const>::value, + "Error"); +static_assert(!std::is_constructible<Empty, void() const>::value, "Error"); +static_assert(!std::is_constructible<U, void() const>::value, "Error"); +static_assert(!std::is_constructible<E, void() const>::value, "Error"); +static_assert(!std::is_constructible<SE, void() const>::value, "Error"); +static_assert(!std::is_constructible<OpE, void() const>::value, "Error"); +static_assert(!std::is_constructible<OpSE, void() const>::value, "Error"); +static_assert(!std::is_constructible<int[], void() const>::value, "Error"); +static_assert(!std::is_constructible<int[1], void() const>::value, "Error"); + +static_assert(!std::is_constructible<void, int, int>::value, "Error"); +static_assert(!std::is_constructible<void, Empty, B>::value, "Error"); +static_assert(!std::is_constructible<void, Empty, Empty>::value, "Error"); +static_assert(!std::is_constructible<void, U, Empty>::value, "Error"); +static_assert(!std::is_constructible<void, U, U>::value, "Error"); +static_assert(!std::is_constructible<void, std::nullptr_t, + std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<void, int[1], int[1]>::value, "Error"); +static_assert(!std::is_constructible<void, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<void, void, int>::value, "Error"); +static_assert(!std::is_constructible<void, void, void>::value, "Error"); +static_assert(!std::is_constructible<void, void(), void()>::value, "Error"); +static_assert(!std::is_constructible<void, void() const, + void() volatile>::value, "Error"); + +static_assert(!std::is_constructible<int, int, int>::value, "Error"); +static_assert(!std::is_constructible<const int, int, int>::value, "Error"); +static_assert(!std::is_constructible<int, void, int>::value, "Error"); +static_assert(!std::is_constructible<const int, void, int>::value, "Error"); +static_assert(!std::is_constructible<int, void, void>::value, "Error"); +static_assert(!std::is_constructible<const int, void, void>::value, "Error"); +static_assert(!std::is_constructible<bool, int, int>::value, "Error"); +static_assert(!std::is_constructible<const bool, int, int>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t, int, int>::value, "Error"); +static_assert(!std::is_constructible<const std::nullptr_t, int, int>::value, + "Error"); +static_assert(!std::is_constructible<std::nullptr_t, void, int>::value, + "Error"); +static_assert(!std::is_constructible<const std::nullptr_t, void, int>::value, + "Error"); +static_assert(!std::is_constructible<std::nullptr_t, void, void>::value, + "Error"); +static_assert(!std::is_constructible<const std::nullptr_t, void, void>::value, + "Error"); +static_assert(!std::is_constructible<E, int, int>::value, "Error"); +static_assert(!std::is_constructible<const E, int, int>::value, "Error"); +static_assert(!std::is_constructible<E, void, int>::value, "Error"); +static_assert(!std::is_constructible<const E, void, int>::value, "Error"); +static_assert(!std::is_constructible<E, void, void>::value, "Error"); +static_assert(!std::is_constructible<const E, void, void>::value, "Error"); +static_assert(!std::is_constructible<SE, int, int>::value, "Error"); +static_assert(!std::is_constructible<const SE, int, int>::value, "Error"); +static_assert(!std::is_constructible<SE, void, int>::value, "Error"); +static_assert(!std::is_constructible<const SE, void, int>::value, "Error"); +static_assert(!std::is_constructible<SE, void, void>::value, "Error"); +static_assert(!std::is_constructible<const SE, void, void>::value, "Error"); +static_assert(!std::is_constructible<OpE, int, int>::value, "Error"); +static_assert(!std::is_constructible<const OpE, int, int>::value, "Error"); +static_assert(!std::is_constructible<OpE, void, int>::value, "Error"); +static_assert(!std::is_constructible<const OpE, void, int>::value, "Error"); +static_assert(!std::is_constructible<OpE, void, void>::value, "Error"); +static_assert(!std::is_constructible<const OpE, void, void>::value, "Error"); +static_assert(!std::is_constructible<OpSE, int, int>::value, "Error"); +static_assert(!std::is_constructible<const OpSE, int, int>::value, "Error"); +static_assert(!std::is_constructible<OpSE, void, int>::value, "Error"); +static_assert(!std::is_constructible<const OpSE, void, int>::value, "Error"); +static_assert(!std::is_constructible<OpSE, void, void>::value, "Error"); +static_assert(!std::is_constructible<const OpSE, void, void>::value, "Error"); +static_assert(!std::is_constructible<Empty, int, int>::value, "Error"); +static_assert(!std::is_constructible<const Empty, int, int>::value, "Error"); +static_assert(!std::is_constructible<Empty, void, int>::value, "Error"); +static_assert(!std::is_constructible<const Empty, void, int>::value, "Error"); +static_assert(!std::is_constructible<Empty, void, void>::value, "Error"); +static_assert(!std::is_constructible<const Empty, void, void>::value, "Error"); +static_assert(!std::is_constructible<U, int, int>::value, "Error"); +static_assert(!std::is_constructible<const U, int, int>::value, "Error"); +static_assert(!std::is_constructible<U, void, int>::value, "Error"); +static_assert(!std::is_constructible<const U, void, int>::value, "Error"); +static_assert(!std::is_constructible<U, void, void>::value, "Error"); +static_assert(!std::is_constructible<const U, void, void>::value, "Error"); +static_assert(!std::is_constructible<B, int, int>::value, "Error"); +static_assert(!std::is_constructible<const B, int, int>::value, "Error"); +static_assert(!std::is_constructible<B, void, int>::value, "Error"); +static_assert(!std::is_constructible<const B, void, int>::value, "Error"); +static_assert(!std::is_constructible<B, void, void>::value, "Error"); +static_assert(!std::is_constructible<const B, void, void>::value, "Error"); +static_assert(!std::is_constructible<Any, int, int>::value, "Error"); +static_assert(!std::is_constructible<const Any, int, int>::value, "Error"); +static_assert(!std::is_constructible<Any, void, int>::value, "Error"); +static_assert(!std::is_constructible<const Any, void, int>::value, "Error"); +static_assert(!std::is_constructible<Any, void, void>::value, "Error"); +static_assert(!std::is_constructible<const Any, void, void>::value, "Error"); +static_assert(!std::is_constructible<nAny, void, int>::value, "Error"); +static_assert(!std::is_constructible<const nAny, void, int>::value, "Error"); +static_assert(!std::is_constructible<nAny, void, void>::value, "Error"); +static_assert(!std::is_constructible<const nAny, void, void>::value, "Error"); +static_assert(!std::is_constructible<FromArgs<>, int, int>::value, "Error"); +static_assert(!std::is_constructible<const FromArgs<>, int, int>::value, + "Error"); +static_assert(!std::is_constructible<FromArgs<>, void, int>::value, "Error"); +static_assert(!std::is_constructible<const FromArgs<>, void, int>::value, + "Error"); +static_assert(!std::is_constructible<FromArgs<>, void, void>::value, "Error"); +static_assert(!std::is_constructible<const FromArgs<>, void, void>::value, + "Error"); +static_assert(!std::is_constructible<Abstract, int, int>::value, "Error"); +static_assert(!std::is_constructible<const Abstract, int, int>::value, "Error"); +static_assert(!std::is_constructible<Abstract, void, int>::value, "Error"); +static_assert(!std::is_constructible<const Abstract, void, int>::value, + "Error"); +static_assert(!std::is_constructible<Abstract, void, void>::value, "Error"); +static_assert(!std::is_constructible<const Abstract, void, void>::value, + "Error"); +static_assert(!std::is_constructible<AbstractDelDtor, int, int>::value, + "Error"); +static_assert(!std::is_constructible<const AbstractDelDtor, int, int>::value, + "Error"); +static_assert(!std::is_constructible<AbstractDelDtor, void, int>::value, + "Error"); +static_assert(!std::is_constructible<const AbstractDelDtor, void, int>::value, + "Error"); +static_assert(!std::is_constructible<AbstractDelDtor, void, void>::value, + "Error"); +static_assert(!std::is_constructible<const AbstractDelDtor, void, void>::value, + "Error"); +static_assert(!std::is_constructible<int[1], int, int>::value, "Error"); +static_assert(!std::is_constructible<const int[1], int, int>::value, "Error"); +static_assert(!std::is_constructible<int[1], void, int>::value, "Error"); +static_assert(!std::is_constructible<const int[1], void, int>::value, "Error"); +static_assert(!std::is_constructible<int[1], void, void>::value, "Error"); +static_assert(!std::is_constructible<const int[1], void, void>::value, "Error"); +static_assert(!std::is_constructible<int&, int, int>::value, "Error"); +static_assert(!std::is_constructible<int&, void, int>::value, "Error"); +static_assert(!std::is_constructible<int&, void, void>::value, "Error"); +static_assert(!std::is_constructible<int&, int&, int&>::value, "Error"); +static_assert(!std::is_constructible<int&, void, int&>::value, "Error"); +static_assert(!std::is_constructible<int&, void, void>::value, "Error"); +static_assert(!std::is_constructible<std::nullptr_t&, int, int>::value, + "Error"); +static_assert(!std::is_constructible<std::nullptr_t&, void, int>::value, + "Error"); +static_assert(!std::is_constructible<std::nullptr_t&, void, void>::value, + "Error"); +static_assert(!std::is_constructible<E&, int, int>::value, "Error"); +static_assert(!std::is_constructible<E&, void, int>::value, "Error"); +static_assert(!std::is_constructible<E&, void, void>::value, "Error"); +static_assert(!std::is_constructible<SE&, int, int>::value, "Error"); +static_assert(!std::is_constructible<SE&, void, int>::value, "Error"); +static_assert(!std::is_constructible<SE&, void, void>::value, "Error"); +static_assert(!std::is_constructible<OpE&, int, int>::value, "Error"); +static_assert(!std::is_constructible<OpE&, void, int>::value, "Error"); +static_assert(!std::is_constructible<OpE&, void, void>::value, "Error"); +static_assert(!std::is_constructible<OpSE&, int, int>::value, "Error"); +static_assert(!std::is_constructible<OpSE&, void, int>::value, "Error"); +static_assert(!std::is_constructible<OpSE&, void, void>::value, "Error"); +static_assert(!std::is_constructible<Empty&, int, int>::value, "Error"); +static_assert(!std::is_constructible<Empty&, void, int>::value, "Error"); +static_assert(!std::is_constructible<Empty&, void, void>::value, "Error"); +static_assert(!std::is_constructible<U&, int, int>::value, "Error"); +static_assert(!std::is_constructible<U&, void, int>::value, "Error"); +static_assert(!std::is_constructible<U&, void, void>::value, "Error"); +static_assert(!std::is_constructible<B&, int, int>::value, "Error"); +static_assert(!std::is_constructible<B&, void, int>::value, "Error"); +static_assert(!std::is_constructible<B&, void, void>::value, "Error"); +static_assert(!std::is_constructible<Any&, int, int>::value, "Error"); +static_assert(!std::is_constructible<Any&, void, int>::value, "Error"); +static_assert(!std::is_constructible<Any&, void, void>::value, "Error"); +static_assert(!std::is_constructible<nAny&, void, int>::value, "Error"); +static_assert(!std::is_constructible<nAny&, void, void>::value, "Error"); +static_assert(!std::is_constructible<FromArgs<>&, int, int>::value, "Error"); +static_assert(!std::is_constructible<FromArgs<>&, void, int>::value, "Error"); +static_assert(!std::is_constructible<FromArgs<>&, void, void>::value, "Error"); +static_assert(!std::is_constructible<Abstract&, int, int>::value, "Error"); +static_assert(!std::is_constructible<Abstract&, void, int>::value, "Error"); +static_assert(!std::is_constructible<Abstract&, void, void>::value, "Error"); +static_assert(!std::is_constructible<int(&)[1], int, int>::value, "Error"); +static_assert(!std::is_constructible<int(&)[1], void, int>::value, "Error"); +static_assert(!std::is_constructible<int(&)[1], void, void>::value, "Error"); + +static_assert(!std::is_constructible<void(), int, int>::value, "Error"); +static_assert(!std::is_constructible<void(), void, int>::value, "Error"); +static_assert(!std::is_constructible<void(), void, void>::value, "Error"); +static_assert(!std::is_constructible<void(), void(), int>::value, "Error"); +static_assert(!std::is_constructible<void(), void(), void()>::value, "Error"); + +static_assert(!std::is_constructible<void() const, int, int>::value, "Error"); +static_assert(!std::is_constructible<void() const, void, int>::value, "Error"); +static_assert(!std::is_constructible<void() const, void, void>::value, "Error"); +static_assert(!std::is_constructible<void() const, void() volatile, + int>::value, "Error"); +static_assert(!std::is_constructible<void() const, void() volatile const, + void() const>::value, "Error"); + +static_assert(!std::is_constructible<FromArgs<int>, int, int>::value, "Error"); +static_assert(!std::is_constructible<const FromArgs<int>, int, int>::value, + "Error"); +static_assert(!std::is_constructible<FromArgs<int>, void, int>::value, "Error"); +static_assert(!std::is_constructible<const FromArgs<int>, void, int>::value, + "Error"); +static_assert(!std::is_constructible<FromArgs<int, int>, void, int>::value, + "Error"); +static_assert(!std::is_constructible<const FromArgs<int, int>, void, + int>::value, "Error"); + +static_assert(!std::is_constructible<DelDtor, int, B, U>::value, "Error"); +static_assert(!std::is_constructible<const DelDtor, int, B, U>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, int>::value, "Error"); +static_assert(!std::is_constructible<const DelDtor, int>::value, "Error"); +static_assert(!std::is_constructible<DelDtor>::value, "Error"); +static_assert(!std::is_constructible<const DelDtor>::value, "Error"); +static_assert(!std::is_constructible<DelDtor, void*, void(&)()>::value, + "Error"); +static_assert(!std::is_constructible<const DelDtor, void*, void(&)()>::value, + "Error"); + +static_assert(!std::is_constructible<AbstractDelDtor>::value, "Error"); +static_assert(!std::is_constructible<const AbstractDelDtor>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis>::value, "Error"); +static_assert(!std::is_constructible<const DelEllipsis>::value, "Error"); +static_assert(!std::is_constructible<DelEllipsis, double>::value, "Error"); +static_assert(!std::is_constructible<const DelEllipsis, double>::value, + "Error"); +static_assert(!std::is_constructible<DelEllipsis, double, int&>::value, + "Error"); +static_assert(!std::is_constructible<const DelEllipsis, double, int&>::value, + "Error"); +static_assert(!std::is_constructible<DelnAny>::value, "Error"); +static_assert(!std::is_constructible<const DelnAny>::value, "Error"); +static_assert(!std::is_constructible<DelnAny, int>::value, "Error"); +static_assert(!std::is_constructible<const DelnAny, int>::value, "Error"); +static_assert(!std::is_constructible<DelnAny, int, void*>::value, "Error"); +static_assert(!std::is_constructible<const DelnAny, int, void*>::value, + "Error"); +static_assert(!std::is_constructible<DelnAny, Empty, B, D>::value, "Error"); +static_assert(!std::is_constructible<const DelnAny, Empty, B, D>::value, + "Error"); + +// Deleted members in unions with non-trivial members: +static_assert(!std::is_constructible<NontrivialUnion>::value, "Error"); +static_assert(!std::is_constructible<NontrivialUnion, + const NontrivialUnion&>::value, "Error"); + +// Unusual copy: +static_assert(!std::is_constructible<UnusualCopy>::value, "Error"); +static_assert(!std::is_constructible<UnusualCopy, UnusualCopy>::value, "Error"); +static_assert(!std::is_constructible<UnusualCopy, + UnusualCopy&&>::value, "Error"); +static_assert(!std::is_constructible<UnusualCopy, + const UnusualCopy&>::value, "Error"); +static_assert(std::is_constructible<UnusualCopy, UnusualCopy&>::value, "Error"); + +static_assert(std::is_constructible<FromArgs<int, char>, + int, char>::value, "Error"); +static_assert(std::is_constructible<const FromArgs<int, char>, + int, char>::value, "Error"); +static_assert(std::is_constructible<FromArgs<int, char>, + int, int>::value, "Error"); +static_assert(std::is_constructible<const FromArgs<int, char>, + int, int>::value, "Error"); +static_assert(std::is_constructible<nAny, int, int>::value, "Error"); +static_assert(std::is_constructible<const nAny, int, int>::value, "Error"); +static_assert(std::is_constructible<FromArgs<int, char>, + ImplicitTo<int>, ImplicitTo<char>>::value, "Error"); +static_assert(std::is_constructible<const FromArgs<int, char>, + ImplicitTo<int>, ImplicitTo<char>>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, int, char>::value, "Error"); +static_assert(std::is_constructible<const Ellipsis, int, char>::value, "Error"); +static_assert(std::is_constructible<Ellipsis, B, U, int&>::value, "Error"); +static_assert(std::is_constructible<const Ellipsis, + B, U, int&>::value, "Error"); +static_assert(std::is_constructible<nAny, B, U, int&>::value, "Error"); +static_assert(std::is_constructible<const nAny, B, U, int&>::value, "Error"); +static_assert(std::is_constructible<FromArgs<std::initializer_list<int>, + std::initializer_list<B>>, std::initializer_list<int>, + std::initializer_list<B>>::value, "Error"); +static_assert(std::is_constructible<const FromArgs<std::initializer_list<int>, + std::initializer_list<B>>, std::initializer_list<int>, + std::initializer_list<B>>::value, "Error"); +static_assert(std::is_constructible<FromArgs<std::initializer_list<int>, + std::initializer_list<B>>, std::initializer_list<int>&, + std::initializer_list<B>&>::value, "Error"); +static_assert(!std::is_constructible<FromArgs<std::initializer_list<int>&, + std::initializer_list<B>&>, std::initializer_list<int>, + std::initializer_list<B>>::value, "Error"); + +static_assert(!std::is_constructible<FromArgs<std::initializer_list<int>>, + int, int>::value, "Error"); +static_assert(!std::is_constructible<const + FromArgs<std::initializer_list<int>>, int, int>::value, "Error"); +static_assert(!std::is_constructible<B[2], B, B>::value, "Error"); +static_assert(!std::is_constructible<const B[2], B, B>::value, "Error"); +static_assert(!std::is_constructible<U[2], U, U>::value, "Error"); +static_assert(!std::is_constructible<const U[2], U, U>::value, "Error"); + +static_assert(!std::is_constructible<E, E, E>::value, "Error"); +static_assert(!std::is_constructible<const E, E, E>::value, "Error"); +static_assert(!std::is_constructible<SE, SE, SE>::value, "Error"); +static_assert(!std::is_constructible<const SE, SE, SE>::value, "Error"); +static_assert(!std::is_constructible<E, B, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<const E, B, std::nullptr_t>::value, + "Error"); +static_assert(!std::is_constructible<SE, B, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<const SE, B, std::nullptr_t>::value, + "Error"); +static_assert(!std::is_constructible<E, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<const E, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<SE, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<const SE, int[], int[]>::value, "Error"); + +static_assert(!std::is_constructible<OpE, OpE, OpE>::value, "Error"); +static_assert(!std::is_constructible<const OpE, OpE, OpE>::value, "Error"); +static_assert(!std::is_constructible<OpSE, OpSE, OpSE>::value, "Error"); +static_assert(!std::is_constructible<const OpSE, OpSE, OpSE>::value, "Error"); +static_assert(!std::is_constructible<OpE, B, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<const OpE, B, std::nullptr_t>::value, + "Error"); +static_assert(!std::is_constructible<OpSE, B, std::nullptr_t>::value, "Error"); +static_assert(!std::is_constructible<const OpSE, B, std::nullptr_t>::value, + "Error"); +static_assert(!std::is_constructible<OpE, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<const OpE, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<OpSE, int[], int[]>::value, "Error"); +static_assert(!std::is_constructible<const OpSE, int[], int[]>::value, "Error"); + +static_assert(!std::is_constructible<int[], int, int>::value, "Error"); +static_assert(!std::is_constructible<const int[], int, int>::value, "Error"); + +static_assert(std::is_constructible<int&, ImplicitTo<int&>>::value, "Error"); +static_assert(std::is_constructible<const int&, ImplicitTo<int&&>>::value, + "Error"); +static_assert(std::is_constructible<int&&, ImplicitTo<int&&>>::value, "Error"); +static_assert(std::is_constructible<const int&, ImplicitTo<int>>::value, + "Error"); + +static_assert(!std::is_constructible<const int&, ExplicitTo<int>>::value, + "Error"); +static_assert(!std::is_constructible<int&&, ExplicitTo<int>>::value, "Error"); + +// Binding through reference-compatible type is required to perform +// direct-initialization as described in [over.match.ref] p. 1 b. 1: +static_assert(std::is_constructible<int&, ExplicitTo<int&>>::value, "Error"); +static_assert(std::is_constructible<const int&, ExplicitTo<int&&>>::value, + "Error"); +static_assert(std::is_constructible<int&&, ExplicitTo<int&&>>::value, "Error"); + +// Binding through temporary behaves like copy-initialization, +// see [dcl.init.ref] p. 5, very last sub-bullet: +static_assert(!std::is_constructible<const int&, ExplicitTo<double&&>>::value, + "Error"); +static_assert(!std::is_constructible<int&&, ExplicitTo<double&&>>::value, + "Error"); diff --git a/libstdc++-v3/testsuite/20_util/is_convertible/value.cc b/libstdc++-v3/testsuite/20_util/is_convertible/value.cc index fc6007a..92ad660 100644 --- a/libstdc++-v3/testsuite/20_util/is_convertible/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_convertible/value.cc @@ -2,7 +2,7 @@ // 2009-10-29 Paolo Carlini <paolo.carlini@oracle.com> // -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -58,6 +58,8 @@ void test01() VERIFY( (test_relationship<is_convertible, void, volatile void>(true)) ); VERIFY( (test_relationship<is_convertible, double&, ExplicitClass>(true)) ); + VERIFY( (test_relationship<is_convertible, int(int), int(&)(int)>(true)) ); + // Negative tests. VERIFY( (test_relationship<is_convertible, const int*, int*>(false)) ); VERIFY( (test_relationship<is_convertible, int*, float*>(false)) ); @@ -93,8 +95,6 @@ void test01() const volatile int&>(false)) ); VERIFY( (test_relationship<is_convertible, volatile int, volatile int&>(false)) ); - VERIFY( (test_relationship<is_convertible, int(int), int(&)(int)>(true)) ); - VERIFY( (test_relationship<is_convertible, int&, ExplicitClass>(false)) ); VERIFY( (test_relationship<is_convertible, void*, ExplicitClass>(false)) ); } diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..dec86a9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_default_constructible<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/requirements/typedefs.cc new file mode 100644 index 0000000..b97d54f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/requirements/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::is_default_constructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc new file mode 100644 index 0000000..bd18d50 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_default_constructible/value.cc @@ -0,0 +1,134 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <initializer_list> +#include <testsuite_tr1.h> + +using namespace __gnu_test::construct_destruct; + +static_assert(std::is_default_constructible<int>::value, "Error"); +static_assert(std::is_default_constructible<int const>::value, "Error"); +static_assert(std::is_default_constructible<int const volatile>::value, + "Error"); +static_assert(std::is_default_constructible<int*>::value, "Error"); +static_assert(std::is_default_constructible<void*>::value, "Error"); +static_assert(std::is_default_constructible<void* const>::value, "Error"); +static_assert(std::is_default_constructible<int B::*>::value, "Error"); +static_assert(std::is_default_constructible<void(*)()>::value, "Error"); +static_assert(std::is_default_constructible<std::nullptr_t>::value, "Error"); +static_assert(std::is_default_constructible<std::nullptr_t const>::value, + "Error"); +static_assert(std::is_default_constructible<Empty>::value, "Error"); +static_assert(std::is_default_constructible<Empty const>::value, "Error"); +static_assert(std::is_default_constructible<FromArgs<>>::value, "Error"); +static_assert(std::is_default_constructible<FromArgs<> const>::value, "Error"); +static_assert(std::is_default_constructible<nAny>::value, "Error"); +static_assert(std::is_default_constructible<nAny const>::value, "Error"); +static_assert(std::is_default_constructible<Ellipsis>::value, "Error"); +static_assert(std::is_default_constructible<Ellipsis const>::value, "Error"); +static_assert(std::is_default_constructible<U>::value, "Error"); +static_assert(std::is_default_constructible<U const>::value, "Error"); +static_assert(std::is_default_constructible<E>::value, "Error"); +static_assert(std::is_default_constructible<E const>::value, "Error"); +static_assert(std::is_default_constructible<SE>::value, "Error"); +static_assert(std::is_default_constructible<SE const>::value, "Error"); +static_assert(std::is_default_constructible<OpE>::value, "Error"); +static_assert(std::is_default_constructible<OpE const>::value, "Error"); +static_assert(std::is_default_constructible<OpSE>::value, "Error"); +static_assert(std::is_default_constructible<OpSE const>::value, "Error"); +static_assert(std::is_default_constructible<int[1]>::value, "Error"); +static_assert(std::is_default_constructible<const int[1]>::value, "Error"); +static_assert(std::is_default_constructible<int[1][2]>::value, "Error"); +static_assert(std::is_default_constructible<const int[1][2]>::value, "Error"); +static_assert(std::is_default_constructible<FromArgs<>[1]>::value, "Error"); +static_assert(std::is_default_constructible<const FromArgs<>[1]>::value, + "Error"); +static_assert(std::is_default_constructible<U[1]>::value, "Error"); +static_assert(std::is_default_constructible<const U[1]>::value, "Error"); +static_assert(std::is_default_constructible<Empty[1]>::value, "Error"); +static_assert(std::is_default_constructible<const Empty[1]>::value, "Error"); +static_assert(std::is_default_constructible<Ellipsis[1]>::value, "Error"); +static_assert(std::is_default_constructible<const Ellipsis[1]>::value, "Error"); +static_assert(std::is_default_constructible<std::nullptr_t[1]>::value, "Error"); +static_assert(std::is_default_constructible<const std::nullptr_t[1]>::value, + "Error"); +static_assert(std::is_default_constructible<nAny[1]>::value, "Error"); +static_assert(std::is_default_constructible<const nAny[1]>::value, "Error"); +static_assert(std::is_default_constructible<E[1]>::value, "Error"); +static_assert(std::is_default_constructible<const E[1]>::value, "Error"); +static_assert(std::is_default_constructible<SE[1]>::value, "Error"); +static_assert(std::is_default_constructible<const SE[1]>::value, "Error"); +static_assert(std::is_default_constructible<OpE[1]>::value, "Error"); +static_assert(std::is_default_constructible<const OpE[1]>::value, "Error"); +static_assert(std::is_default_constructible<OpSE[1]>::value, "Error"); +static_assert(std::is_default_constructible<const OpSE[1]>::value, "Error"); +static_assert(std::is_default_constructible<int*[1]>::value, "Error"); +static_assert(std::is_default_constructible<int* const[1]>::value, "Error"); +static_assert(std::is_default_constructible<int B::*[1]>::value, "Error"); +static_assert(std::is_default_constructible<int B::* const[1]>::value, "Error"); +static_assert(std::is_default_constructible<std::initializer_list<int>>::value, + "Error"); +static_assert(std::is_default_constructible<const + std::initializer_list<int>>::value, "Error"); +static_assert(std::is_default_constructible< + std::initializer_list<int>[1]>::value, "Error"); +static_assert(std::is_default_constructible<const + std::initializer_list<int>[1]>::value, "Error"); + +static_assert(!std::is_default_constructible<void>::value, "Error"); +static_assert(!std::is_default_constructible<const void>::value, "Error"); +static_assert(!std::is_default_constructible<Abstract>::value, "Error"); +static_assert(!std::is_default_constructible<const Abstract>::value, "Error"); +static_assert(!std::is_default_constructible<Any>::value, "Error"); +static_assert(!std::is_default_constructible<const Any>::value, "Error"); +static_assert(!std::is_default_constructible<FromArgs<int>>::value, "Error"); +static_assert(!std::is_default_constructible<const FromArgs<int>>::value, + "Error"); +static_assert(!std::is_default_constructible<int&>::value, "Error"); +static_assert(!std::is_default_constructible<int&&>::value, "Error"); +static_assert(!std::is_default_constructible<void()>::value, "Error"); +static_assert(!std::is_default_constructible<void() const volatile>::value, + "Error"); +static_assert(!std::is_default_constructible<void(&)()>::value, "Error"); +static_assert(!std::is_default_constructible<int(&)[1]>::value, "Error"); +static_assert(!std::is_default_constructible<int(&)[]>::value, "Error"); +static_assert(!std::is_default_constructible<int[]>::value, "Error"); +static_assert(!std::is_default_constructible<const int[]>::value, "Error"); +static_assert(!std::is_default_constructible<int[][1][2]>::value, "Error"); +static_assert(!std::is_default_constructible<const int[][1][2]>::value, + "Error"); +static_assert(!std::is_default_constructible<Any[1]>::value, "Error"); +static_assert(!std::is_default_constructible<const Any[1]>::value, "Error"); +static_assert(!std::is_default_constructible<FromArgs<int>[1]>::value, "Error"); +static_assert(!std::is_default_constructible<const FromArgs<int>[1]>::value, + "Error"); +static_assert(!std::is_default_constructible< + FromArgs<std::initializer_list<int>>>::value, "Error"); +static_assert(!std::is_default_constructible<const + FromArgs<std::initializer_list<int>>>::value, "Error"); +static_assert(!std::is_default_constructible<const + FromArgs<const std::initializer_list<int>>>::value, "Error"); +static_assert(!std::is_default_constructible<DelDef>::value, "Error"); +static_assert(!std::is_default_constructible<const DelDef>::value, "Error"); +static_assert(!std::is_default_constructible<DelCopy>::value, "Error"); +static_assert(!std::is_default_constructible<const DelCopy>::value, "Error"); +static_assert(!std::is_default_constructible<DelDtor>::value, "Error"); +static_assert(!std::is_default_constructible<const DelDtor>::value, "Error"); diff --git a/libstdc++-v3/testsuite/20_util/is_destructible/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_destructible/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..59b5980 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_destructible/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_destructible<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_destructible/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_destructible/requirements/typedefs.cc new file mode 100644 index 0000000..967842d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_destructible/requirements/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::is_destructible<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_destructible/value.cc b/libstdc++-v3/testsuite/20_util/is_destructible/value.cc new file mode 100644 index 0000000..b0382c6e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_destructible/value.cc @@ -0,0 +1,100 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <initializer_list> +#include <testsuite_tr1.h> + +using namespace __gnu_test::construct_destruct; + +static_assert(std::is_destructible<int>::value, "Error"); +static_assert(std::is_destructible<const int>::value, "Error"); +static_assert(std::is_destructible<bool>::value, "Error"); +static_assert(std::is_destructible<const bool>::value, "Error"); +static_assert(std::is_destructible<int*>::value, "Error"); +static_assert(std::is_destructible<void*>::value, "Error"); +static_assert(std::is_destructible<int B::*>::value, "Error"); +static_assert(std::is_destructible<const int D::*>::value, "Error"); +static_assert(std::is_destructible<E>::value, "Error"); +static_assert(std::is_destructible<const E>::value, "Error"); +static_assert(std::is_destructible<SE>::value, "Error"); +static_assert(std::is_destructible<const SE>::value, "Error"); +static_assert(std::is_destructible<OpE>::value, "Error"); +static_assert(std::is_destructible<const OpE>::value, "Error"); +static_assert(std::is_destructible<OpSE>::value, "Error"); +static_assert(std::is_destructible<const OpSE>::value, "Error"); +static_assert(std::is_destructible<std::nullptr_t>::value, "Error"); +static_assert(std::is_destructible<const std::nullptr_t>::value, "Error"); +static_assert(std::is_destructible<B>::value, "Error"); +static_assert(std::is_destructible<const B>::value, "Error"); +static_assert(std::is_destructible<D>::value, "Error"); +static_assert(std::is_destructible<const D>::value, "Error"); +static_assert(std::is_destructible<Empty>::value, "Error"); +static_assert(std::is_destructible<const Empty>::value, "Error"); +static_assert(std::is_destructible<U>::value, "Error"); +static_assert(std::is_destructible<const U>::value, "Error"); +static_assert(std::is_destructible<Abstract>::value, "Error"); +static_assert(std::is_destructible<const Abstract>::value, "Error"); +static_assert(std::is_destructible<int[1]>::value, "Error"); +static_assert(std::is_destructible<const int[1]>::value, "Error"); +static_assert(std::is_destructible<int[1][2]>::value, "Error"); +static_assert(std::is_destructible<const int[1][2]>::value, "Error"); +static_assert(std::is_destructible<int&>::value, "Error"); +static_assert(std::is_destructible<int&&>::value, "Error"); +static_assert(std::is_destructible<void(&)()>::value, "Error"); +static_assert(std::is_destructible<Ellipsis>::value, "Error"); +static_assert(std::is_destructible<const Ellipsis>::value, "Error"); +static_assert(std::is_destructible<Any>::value, "Error"); +static_assert(std::is_destructible<const Any>::value, "Error"); +static_assert(std::is_destructible<nAny>::value, "Error"); +static_assert(std::is_destructible<const nAny>::value, "Error"); +static_assert(std::is_destructible<DelDef>::value, "Error"); +static_assert(std::is_destructible<const DelDef>::value, "Error"); +static_assert(std::is_destructible<DelCopy>::value, "Error"); +static_assert(std::is_destructible<const DelCopy>::value, "Error"); +static_assert(std::is_destructible<DelEllipsis>::value, "Error"); +static_assert(std::is_destructible<const DelEllipsis>::value, "Error"); +static_assert(std::is_destructible<std::initializer_list<int>>::value, + "Error"); +static_assert(std::is_destructible<const std::initializer_list<int>>::value, + "Error"); +static_assert(std::is_destructible<void()>::value, "Error"); +static_assert(std::is_destructible<void() const>::value, "Error"); + +static_assert(!std::is_destructible<void>::value, "Error"); +static_assert(!std::is_destructible<const void>::value, "Error"); +static_assert(!std::is_destructible<int[]>::value, "Error"); +static_assert(!std::is_destructible<const int[]>::value, "Error"); +static_assert(!std::is_destructible<DelDtor>::value, "Error"); +static_assert(!std::is_destructible<const DelDtor>::value, "Error"); +static_assert(!std::is_destructible<AbstractDelDtor>::value, "Error"); +static_assert(!std::is_destructible<const AbstractDelDtor>::value, "Error"); +static_assert(!std::is_destructible<int[][1]>::value, "Error"); +static_assert(!std::is_destructible<const int[][1]>::value, "Error"); +static_assert(!std::is_destructible<DelDtor[1]>::value, "Error"); +static_assert(!std::is_destructible<const DelDtor[1]>::value, "Error"); +static_assert(!std::is_destructible<DelDtor[]>::value, "Error"); +static_assert(!std::is_destructible<const DelDtor[]>::value, "Error"); + +// Deleted members in unions with non-trivial members: +static_assert(!std::is_destructible<NontrivialUnion>::value, "Error"); + +// Unusual copy: +static_assert(std::is_destructible<UnusualCopy>::value, "Error"); diff --git a/libstdc++-v3/testsuite/20_util/is_function/24808.cc b/libstdc++-v3/testsuite/20_util/is_function/24808.cc new file mode 100644 index 0000000..38358e5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_function/24808.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +// libstdc++/24808 +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_function; + using namespace __gnu_test; + + VERIFY( (test_category<is_function, IncompleteClass>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_function/35637.cc b/libstdc++-v3/testsuite/20_util/is_function/35637.cc new file mode 100644 index 0000000..52686fbc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_function/35637.cc @@ -0,0 +1,32 @@ +// { dg-options "-std=gnu++0x -pedantic-errors" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <functional> + +struct S +{ + void F() const {} +}; + +// libstdc++/35637 +void test01() +{ + std::function<void (S *)> a(&S::F); +} diff --git a/libstdc++-v3/testsuite/20_util/is_function/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_function/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..dc340d7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_function/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_function<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_function/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_function/requirements/typedefs.cc new file mode 100644 index 0000000..5b5e35f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_function/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_function<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_function/value.cc b/libstdc++-v3/testsuite/20_util/is_function/value.cc new file mode 100644 index 0000000..5f576eb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_function/value.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_function; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_function, int (int)>(true)) ); + VERIFY( (test_category<is_function, ClassType (ClassType)>(true)) ); + VERIFY( (test_category<is_function, float (int, float, int[], int&)>(true)) ); + VERIFY( (test_category<is_function, int (int, ...)>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_function, int&>(false)) ); + VERIFY( (test_category<is_function, void>(false)) ); + VERIFY( (test_category<is_function, const void>(false)) ); + + VERIFY( (test_category<is_function, AbstractClass>(false)) ); + VERIFY( (test_category<is_function, int(&)(int)>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_function, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_fundamental/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_fundamental/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..b168261 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_fundamental/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_fundamental<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_fundamental/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_fundamental/requirements/typedefs.cc new file mode 100644 index 0000000..efb672e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_fundamental/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_fundamental<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_fundamental/value.cc b/libstdc++-v3/testsuite/20_util/is_fundamental/value.cc new file mode 100644 index 0000000..83091a1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_fundamental/value.cc @@ -0,0 +1,57 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_fundamental; + using namespace __gnu_test; + + VERIFY( (test_category<is_fundamental, void>(true)) ); + VERIFY( (test_category<is_fundamental, char>(true)) ); + VERIFY( (test_category<is_fundamental, signed char>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned char>(true)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category<is_fundamental, wchar_t>(true)) ); +#endif + VERIFY( (test_category<is_fundamental, short>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned short>(true)) ); + VERIFY( (test_category<is_fundamental, int>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned int>(true)) ); + VERIFY( (test_category<is_fundamental, long>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned long>(true)) ); + VERIFY( (test_category<is_fundamental, long long>(true)) ); + VERIFY( (test_category<is_fundamental, unsigned long long>(true)) ); + VERIFY( (test_category<is_fundamental, float>(true)) ); + VERIFY( (test_category<is_fundamental, double>(true)) ); + VERIFY( (test_category<is_fundamental, long double>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_fundamental, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_function_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_member_function_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..304efcc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_function_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_member_function_pointer<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_function_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_member_function_pointer/requirements/typedefs.cc new file mode 100644 index 0000000..2efcdda --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_function_pointer/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_member_function_pointer<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_function_pointer/value.cc b/libstdc++-v3/testsuite/20_util/is_member_function_pointer/value.cc new file mode 100644 index 0000000..d09c7ca --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_function_pointer/value.cc @@ -0,0 +1,58 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_member_function_pointer; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*) (int) const>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*) (float, ...)>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + ClassType (ClassType::*) (ClassType)>(true)) ); + VERIFY( (test_category<is_member_function_pointer, + float (ClassType::*) (int, float, int[], int&)>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_member_function_pointer, + int (ClassType::*)>(false)) ); + VERIFY( (test_category<is_member_function_pointer, + const int (ClassType::*)>(false)) ); + VERIFY( (test_category<is_member_function_pointer, + ClassType (ClassType::*)>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_member_function_pointer, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_object_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_member_object_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..5d2b686 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_object_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_member_object_pointer<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_object_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_member_object_pointer/requirements/typedefs.cc new file mode 100644 index 0000000..13c94b7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_object_pointer/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_member_object_pointer<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_object_pointer/value.cc b/libstdc++-v3/testsuite/20_util/is_member_object_pointer/value.cc new file mode 100644 index 0000000..2e004e3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_object_pointer/value.cc @@ -0,0 +1,58 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_member_object_pointer; + using namespace __gnu_test; + + // Positive tests. + VERIFY( (test_category<is_member_object_pointer, + int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_member_object_pointer, + const int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_member_object_pointer, + ClassType (ClassType::*)>(true)) ); + + // Negative tests. + VERIFY( (test_category<is_member_object_pointer, + int (ClassType::*) (int)>(false)) ); + VERIFY( (test_category<is_member_object_pointer, + int (ClassType::*) (int) const>(false)) ); + VERIFY( (test_category<is_member_object_pointer, + int (ClassType::*) (float, ...)>(false)) ); + VERIFY( (test_category<is_member_object_pointer, + ClassType (ClassType::*) (ClassType)>(false)) ); + VERIFY( (test_category<is_member_object_pointer, + float (ClassType::*) (int, float, int[], int&)>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_member_object_pointer, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_pointer/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_member_pointer/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..f94959e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_pointer/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_member_pointer<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_pointer/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_member_pointer/requirements/typedefs.cc new file mode 100644 index 0000000..9491ee8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_pointer/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_member_pointer<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_member_pointer/value.cc b/libstdc++-v3/testsuite/20_util/is_member_pointer/value.cc new file mode 100644 index 0000000..fff9710 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_member_pointer/value.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_member_pointer; + using namespace __gnu_test; + + VERIFY( (test_category<is_member_pointer, int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_member_pointer, const int (ClassType::*)>(true)) ); + VERIFY( (test_category<is_member_pointer, ClassType (ClassType::*)>(true)) ); + + VERIFY( (test_category<is_member_pointer, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<is_member_pointer, + int (ClassType::*) (int) const>(true)) ); + VERIFY( (test_category<is_member_pointer, + int (ClassType::*) (float, ...)>(true)) ); + VERIFY( (test_category<is_member_pointer, + ClassType (ClassType::*) (ClassType)>(true)) ); + VERIFY( (test_category<is_member_pointer, + float (ClassType::*) (int, float, int[], int&)>(true)) ); + + // Sanity check. + VERIFY( (test_category<is_member_pointer, ClassType>(false)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_object/24808.cc b/libstdc++-v3/testsuite/20_util/is_object/24808.cc new file mode 100644 index 0000000..f1fd168 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_object/24808.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +// libstdc++/24808 +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_object; + using namespace __gnu_test; + + VERIFY( (test_category<is_object, IncompleteClass>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/is_object/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_object/requirements/explicit_instantiation.cc new file mode 100644 index 0000000..6ee7c4e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_object/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_object<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/is_object/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_object/requirements/typedefs.cc new file mode 100644 index 0000000..bec0a8c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_object/requirements/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::is_object<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/20_util/is_object/value.cc b/libstdc++-v3/testsuite/20_util/is_object/value.cc new file mode 100644 index 0000000..b3d8df6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_object/value.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_object; + using namespace __gnu_test; + + VERIFY( (test_category<is_object, int (int)>(false)) ); + VERIFY( (test_category<is_object, ClassType (ClassType)>(false)) ); + VERIFY( (test_category<is_object, float (int, float, int[], int&)>(false)) ); + VERIFY( (test_category<is_object, int&>(false)) ); + VERIFY( (test_category<is_object, ClassType&>(false)) ); + VERIFY( (test_category<is_object, int(&)(int)>(false)) ); + VERIFY( (test_category<is_object, void>(false)) ); + VERIFY( (test_category<is_object, const void>(false)) ); + + // Sanity check. + VERIFY( (test_category<is_object, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 5179abf..4a568e36 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -3,7 +3,7 @@ // 2007-05-03 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -48,5 +48,5 @@ void test01() // { dg-error "instantiated from here" "" { target *-*-* } 40 } // { dg-error "instantiated from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1097 } -// { dg-error "declaration of" "" { target *-*-* } 1061 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1302 } +// { dg-error "declaration of" "" { target *-*-* } 1266 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 1a1724d..955c1ce 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "instantiated from here" "" { target *-*-* } 40 } // { dg-error "instantiated from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1020 } -// { dg-error "declaration of" "" { target *-*-* } 984 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1226 } +// { dg-error "declaration of" "" { target *-*-* } 1190 } diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc index ca91e46..6a611e8 100644 --- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc +++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc @@ -51,4 +51,4 @@ test04() // { dg-error "instantiated from here" "" { target *-*-* } 46 } // { dg-error "denominator cannot be zero" "" { target *-*-* } 155 } // { dg-error "out of range" "" { target *-*-* } 156 } -// { dg-error "overflow in constant expression" "" { target *-*-* } 74 } +// { dg-error "overflow in constant expression" "" { target *-*-* } 99 } diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h index 6a48a30..7e36ee3 100644 --- a/libstdc++-v3/testsuite/util/testsuite_tr1.h +++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h @@ -1,7 +1,7 @@ // -*- C++ -*- // Testing utilities for the tr1 testsuite. // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 +// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -283,6 +283,130 @@ namespace __gnu_test check_ret_type(T) { return true; } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + namespace construct_destruct + { + struct Empty {}; + + struct B { int i; B(){} }; + struct D : B {}; + + enum E { ee1 }; + enum E2 { ee2 }; + enum class SE { e1 }; + enum class SE2 { e2 }; + + enum OpE : int; + enum class OpSE : bool; + + union U { int i; Empty b; }; + + struct Abstract + { + virtual ~Abstract() = 0; + }; + + struct AbstractDelDtor + { + ~AbstractDelDtor() = delete; + virtual void foo() = 0; + }; + + struct Ukn; + + template<class To> + struct ImplicitTo + { + operator To(); + }; + + template<class To> + struct DelImplicitTo + { + operator To() = delete; + }; + + template<class To> + struct ExplicitTo + { + explicit operator To(); + }; + + struct Ellipsis + { + Ellipsis(...){} + }; + + struct DelEllipsis + { + DelEllipsis(...) = delete; + }; + + struct Any + { + template<class T> + Any(T&&){} + }; + + struct nAny + { + template<class... T> + nAny(T&&...){} + }; + + struct DelnAny + { + template<class... T> + DelnAny(T&&...) = delete; + }; + + template<class... Args> + struct FromArgs + { + FromArgs(Args...); + }; + + struct DelDef + { + DelDef() = delete; + }; + + struct DelCopy + { + DelCopy(const DelCopy&) = delete; + }; + + struct DelDtor + { + DelDtor() = default; + DelDtor(const DelDtor&) = default; + DelDtor(DelDtor&&) = default; + DelDtor(int); + DelDtor(int, B, U); + ~DelDtor() = delete; + }; + + struct Nontrivial + { + Nontrivial(); + Nontrivial(const Nontrivial&); + Nontrivial& operator=(const Nontrivial&); + ~Nontrivial(); + }; + + union NontrivialUnion + { + int i; + Nontrivial n; + }; + + struct UnusualCopy + { + UnusualCopy(UnusualCopy&); + }; + } +#endif + } // namespace __gnu_test #endif // _GLIBCXX_TESTSUITE_TR1_H |