diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-03 11:49:12 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-03 11:49:12 +0000 |
commit | 6b75e1228cecab24ff5650ca0e98b8f7aae8d5ad (patch) | |
tree | 0eaf34c95af482c6071365bbd8c1795345165567 /libstdc++-v3 | |
parent | ad3827a6836ecc050d7f688b4716e8f2a9c66e12 (diff) | |
download | gcc-6b75e1228cecab24ff5650ca0e98b8f7aae8d5ad.tar.gz |
2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
* include/std/type_traits (enable_if): New.
(conditional): New.
(__decay_selector, decay): New.
(__cv_selector, __match_cv_qualifiers): New.
(__make_unsigned, __make_unsigned_selector, make_unsigned): New.
(__make_signed, __make_signed_selector, make_signed): New.
(has_trivial_constructor): ... to has_trivial_default_constructor.
(has_nothrow_constructor): ... to has_nothrow_default_constructor.
(has_trivial_copy): ... to has_trivial_copy_constructor.
(has_nothrow_copy): ... to has_nothrow_copy_constructor.
* include/tr1/type_traits_fwd: Move to...
* include/tr1/type_traitsfwd: ... this, consistency with
ios/string/locale forward headers.
* include/tr1/type_traits: Adjust include.
* include/Makefile.am (tr1_headers): Change type_traits_fwd.h to
type_traitsfwd.h.
* include/Makefile.in: Regenerate.
* testsuite/23_containers/tuple: Move...
* testsuite/20_util/tuple:... here.
* testsuite/20_util/conditional: New.
* testsuite/20_util/conditional/requirements: Same.
* testsuite/20_util/conditional/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/conditional/requirements/typedefs.cc: Same.
* testsuite/20_util/decay: Same.
* testsuite/20_util/decay/requirements: Same.
* testsuite/20_util/decay/requirements/explicit_instantiation.cc: Same.
* testsuite/20_util/decay/requirements/typedefs.cc: Same.
* testsuite/20_util/enable_if: Same.
* testsuite/20_util/enable_if/requirements: Same.
* testsuite/20_util/enable_if/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/enable_if/requirements/typedefs.cc: Same.
* testsuite/20_util/enable_if/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/has_nothrow_copy_constructor: Same.
* testsuite/20_util/has_nothrow_copy_constructor/requirements: Same.
* testsuite/20_util/has_nothrow_copy_constructor/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/has_nothrow_copy_constructor/requirements/
typedefs.cc: Same.
* testsuite/20_util/has_nothrow_copy_constructor/value.cc: Same.
* testsuite/20_util/has_nothrow_default_constructor: Same.
* testsuite/20_util/has_nothrow_default_constructor/requirements: Same.
* testsuite/20_util/has_nothrow_default_constructor/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/has_nothrow_default_constructor/requirements/
typedefs.cc: Same.
* testsuite/20_util/has_nothrow_default_constructor/value.cc: Same.
* testsuite/20_util/has_trivial_copy_constructor: Same.
* testsuite/20_util/has_trivial_copy_constructor/requirements: Same.
* testsuite/20_util/has_trivial_copy_constructor/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/has_trivial_copy_constructor/requirements/
typedefs.cc: Same.
* testsuite/20_util/has_trivial_copy_constructor/value.cc: Same.
* testsuite/20_util/has_trivial_default_constructor: Same.
* testsuite/20_util/has_trivial_default_constructor/requirements: Same.
* testsuite/20_util/has_trivial_default_constructor/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/has_trivial_default_constructor/requirements/
typedefs.cc: Same.
* testsuite/20_util/has_trivial_default_constructor/value.cc: Same.
* testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc: Same.
* testsuite/20_util/make_signed: Same.
* testsuite/20_util/make_signed/requirements: Same.
* testsuite/20_util/make_signed/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned: Same.
* testsuite/20_util/make_unsigned/requirements: Same.
* testsuite/20_util/make_unsigned/requirements/
explicit_instantiation.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124374 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
33 files changed, 1568 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1aee8b0baf8..48a0494cb5b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,84 @@ +2007-05-03 Benjamin Kosnik <bkoz@redhat.com> + + * include/std/type_traits (enable_if): New. + (conditional): New. + (__decay_selector, decay): New. + (__cv_selector, __match_cv_qualifiers): New. + (__make_unsigned, __make_unsigned_selector, make_unsigned): New. + (__make_signed, __make_signed_selector, make_signed): New. + (has_trivial_constructor): ... to has_trivial_default_constructor. + (has_nothrow_constructor): ... to has_nothrow_default_constructor. + (has_trivial_copy): ... to has_trivial_copy_constructor. + (has_nothrow_copy): ... to has_nothrow_copy_constructor. + + * include/tr1/type_traits_fwd: Move to... + * include/tr1/type_traitsfwd: ... this, consistency with + ios/string/locale forward headers. + * include/tr1/type_traits: Adjust include. + * include/Makefile.am (tr1_headers): Change type_traits_fwd.h to + type_traitsfwd.h. + * include/Makefile.in: Regenerate. + + * testsuite/23_containers/tuple: Move... + * testsuite/20_util/tuple:... here. + + * testsuite/20_util/conditional: New. + * testsuite/20_util/conditional/requirements: Same. + * testsuite/20_util/conditional/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/conditional/requirements/typedefs.cc: Same. + * testsuite/20_util/decay: Same. + * testsuite/20_util/decay/requirements: Same. + * testsuite/20_util/decay/requirements/explicit_instantiation.cc: Same. + * testsuite/20_util/decay/requirements/typedefs.cc: Same. + * testsuite/20_util/enable_if: Same. + * testsuite/20_util/enable_if/requirements: Same. + * testsuite/20_util/enable_if/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/enable_if/requirements/typedefs.cc: Same. + * testsuite/20_util/enable_if/requirements/typedefs_neg.cc: Same. + * testsuite/20_util/has_nothrow_copy_constructor: Same. + * testsuite/20_util/has_nothrow_copy_constructor/requirements: Same. + * testsuite/20_util/has_nothrow_copy_constructor/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/has_nothrow_copy_constructor/requirements/ + typedefs.cc: Same. + * testsuite/20_util/has_nothrow_copy_constructor/value.cc: Same. + * testsuite/20_util/has_nothrow_default_constructor: Same. + * testsuite/20_util/has_nothrow_default_constructor/requirements: Same. + * testsuite/20_util/has_nothrow_default_constructor/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/has_nothrow_default_constructor/requirements/ + typedefs.cc: Same. + * testsuite/20_util/has_nothrow_default_constructor/value.cc: Same. + * testsuite/20_util/has_trivial_copy_constructor: Same. + * testsuite/20_util/has_trivial_copy_constructor/requirements: Same. + * testsuite/20_util/has_trivial_copy_constructor/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/has_trivial_copy_constructor/requirements/ + typedefs.cc: Same. + * testsuite/20_util/has_trivial_copy_constructor/value.cc: Same. + * testsuite/20_util/has_trivial_default_constructor: Same. + * testsuite/20_util/has_trivial_default_constructor/requirements: Same. + * testsuite/20_util/has_trivial_default_constructor/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/has_trivial_default_constructor/requirements/ + typedefs.cc: Same. + * testsuite/20_util/has_trivial_default_constructor/value.cc: Same. + * testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc: Same. + * testsuite/20_util/make_signed: Same. + * testsuite/20_util/make_signed/requirements: Same. + * testsuite/20_util/make_signed/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/make_signed/requirements/typedefs.cc: Same. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same. + * testsuite/20_util/make_unsigned: Same. + * testsuite/20_util/make_unsigned/requirements: Same. + * testsuite/20_util/make_unsigned/requirements/ + explicit_instantiation.cc: Same. + * testsuite/20_util/make_unsigned/requirements/typedefs.cc: Same. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. + 2007-05-02 Paolo Carlini <pcarlini@suse.de> PR libstdc++/31777 diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 75be19a5f78..ea27464432e 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -592,7 +592,7 @@ tr1_headers = \ ${tr1_srcdir}/tgmath.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/type_traits \ - ${tr1_srcdir}/type_traits_fwd.h \ + ${tr1_srcdir}/type_traitsfwd.h \ ${tr1_srcdir}/unordered_set \ ${tr1_srcdir}/unordered_map \ ${tr1_srcdir}/utility \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 5b4ad599218..4402d84c67f 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -822,7 +822,7 @@ tr1_headers = \ ${tr1_srcdir}/tgmath.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/type_traits \ - ${tr1_srcdir}/type_traits_fwd.h \ + ${tr1_srcdir}/type_traitsfwd.h \ ${tr1_srcdir}/unordered_set \ ${tr1_srcdir}/unordered_map \ ${tr1_srcdir}/utility \ diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 1d83dabd861..0d7e85e5300 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -42,5 +42,305 @@ # include <c++0x_warning.h> #endif +_GLIBCXX_BEGIN_NAMESPACE(std) + + // Define a nested type if some predicate holds. + template<bool, typename _Tp = void> + struct enable_if + { }; + + template<typename _Tp> + struct enable_if<true, _Tp> + { typedef _Tp type; }; + + + // Like a conditional expression, but for types. If true, first, if + // false, second. + template<bool _Cond, typename _Iftrue, typename _Iffalse> + struct conditional + { typedef _Iftrue type; }; + + template<typename _Iftrue, typename _Iffalse> + struct conditional<false, _Iftrue, _Iffalse> + { typedef _Iffalse 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; + + template<typename _Up> + struct __decay_selector<_Up, false, false> + { typedef _Up __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; }; + + template<typename _Tp> + struct decay + { + private: + typedef typename remove_reference<_Tp>::type __remove_type; + + public: + typedef typename __decay_selector<__remove_type>::__type type; + }; + + + // Utility for constructing identically cv-qualified types. + template<typename _Unqualified, bool _IsConst, bool _IsVol> + struct __cv_selector; + + template<typename _Unqualified> + struct __cv_selector<_Unqualified, false, false> + { typedef _Unqualified __type; }; + + template<typename _Unqualified> + struct __cv_selector<_Unqualified, false, true> + { typedef volatile _Unqualified __type; }; + + template<typename _Unqualified> + struct __cv_selector<_Unqualified, true, false> + { typedef const _Unqualified __type; }; + + template<typename _Unqualified> + struct __cv_selector<_Unqualified, true, true> + { typedef const volatile _Unqualified __type; }; + + template<typename _Qualified, typename _Unqualified, + bool _IsConst = is_const<_Qualified>::value, + bool _IsVol = is_volatile<_Qualified>::value> + struct __match_cv_qualifiers + { + private: + typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match; + + public: + typedef typename __match::__type __type; + }; + + + // Utility for finding the unsigned versions of signed integral types. + template<typename _Tp> + struct __make_unsigned; + + template<> + struct __make_unsigned<char> + { typedef unsigned char __type; }; + + template<> + struct __make_unsigned<signed char> + { typedef unsigned char __type; }; + + template<> + struct __make_unsigned<wchar_t> + { typedef unsigned wchar_t __type; }; + + template<> + struct __make_unsigned<short> + { typedef unsigned short __type; }; + + template<> + struct __make_unsigned<int> + { typedef unsigned int __type; }; + + template<> + struct __make_unsigned<long> + { typedef unsigned long __type; }; + + template<> + 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, + bool _IsUnsigned = is_unsigned<_Tp>::value, + bool _IsEnum = is_enum<_Tp>::value> + struct __make_unsigned_selector; + + template<typename _Tp> + struct __make_unsigned_selector<_Tp, true, true, false> + { typedef _Tp __type; }; + + template<typename _Tp> + struct __make_unsigned_selector<_Tp, true, false, false> + { + private: + typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt; + typedef typename __unsignedt::__type __unsigned_type; + typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned; + + public: + typedef typename __cv_unsigned::__type __type; + }; + + template<typename _Tp> + struct __make_unsigned_selector<_Tp, false, true, false> + { + private: + // GNU floating point types start with sizeof int. + static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned int); + static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned long); + typedef conditional<__b2, unsigned long, unsigned long long> __cond; + typedef typename __cond::type __cond_type; + typedef unsigned int __ui_type; + + public: + typedef typename conditional<__b1, __ui_type, __cond_type>::type __type; + }; + + template<typename _Tp> + struct __make_unsigned_selector<_Tp, false, false, true> + { + private: + // GNU enums start with sizeof int. + static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned int); + static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned long); + typedef conditional<__b2, unsigned long, unsigned long long> __cond; + typedef typename __cond::type __cond_type; + typedef unsigned int __ui_type; + + public: + typedef typename conditional<__b1, __ui_type, __cond_type>::type __type; + }; + + // Primary class template. + // Given an integral/enum type, return the corresponding unsigned + // integer type. + template<typename _Tp> + struct make_unsigned + { typedef typename __make_unsigned_selector<_Tp>::__type type; }; + + // Integral, but don't define. + template<> + struct make_unsigned<bool>; + + + // Utility for finding the signed versions of unsigned integral types. + template<typename _Tp> + struct __make_signed; + + template<> + struct __make_signed<char> + { typedef signed char __type; }; + + template<> + struct __make_signed<unsigned char> + { typedef signed char __type; }; + + template<> + struct __make_signed<wchar_t> + { typedef signed wchar_t __type; }; + + template<> + struct __make_signed<unsigned short> + { typedef signed short __type; }; + + template<> + struct __make_signed<unsigned int> + { typedef signed int __type; }; + + template<> + struct __make_signed<unsigned long> + { typedef signed long __type; }; + + template<> + struct __make_signed<unsigned long long> + { typedef signed long long __type; }; + + + // Select between arithmetic and enum: not possible to be both. + template<typename _Tp, + bool _IsInt = is_integral<_Tp>::value, + bool _IsSigned = is_signed<_Tp>::value, + bool _IsEnum = is_enum<_Tp>::value> + struct __make_signed_selector; + + template<typename _Tp> + struct __make_signed_selector<_Tp, true, true, false> + { typedef _Tp __type; }; + + template<typename _Tp> + struct __make_signed_selector<_Tp, true, false, false> + { + private: + typedef __make_signed<typename remove_cv<_Tp>::type> __signedt; + typedef typename __signedt::__type __signed_type; + typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed; + + public: + typedef typename __cv_signed::__type __type; + }; + + template<typename _Tp> + struct __make_signed_selector<_Tp, false, true, false> + { + // GNU floating point types start with sizeof int. + static const bool __b1 = sizeof(_Tp) <= sizeof(signed int); + static const bool __b2 = sizeof(_Tp) <= sizeof(signed long); + typedef conditional<__b2, signed long, signed long long> __cond; + typedef typename __cond::type __cond_type; + typedef unsigned int __i_type; + + public: + typedef typename conditional<__b1, __i_type, __cond_type>::type __type; + }; + + template<typename _Tp> + struct __make_signed_selector<_Tp, false, false, true> + { + private: + // GNU enums start with sizeof int. + static const bool __b1 = sizeof(_Tp) <= sizeof(signed int); + static const bool __b2 = sizeof(_Tp) <= sizeof(signed long); + typedef conditional<__b2, signed long, signed long long> __cond; + typedef typename __cond::type __cond_type; + typedef int __i_type; + + public: + typedef typename conditional<__b1, __i_type, __cond_type>::type __type; + }; + + // Primary class template. + // Given an integral/enum type, return the corresponding signed + // integer type. + template<typename _Tp> + struct make_signed + { typedef typename __make_signed_selector<_Tp>::__type type; }; + + // Integral, but don't define. + template<> + struct make_signed<bool>; + + + template<typename _Tp> + struct has_nothrow_default_constructor + : public integral_constant<bool, is_pod<_Tp>::value> { }; + + template<typename _Tp> + struct has_nothrow_copy_constructor + : public integral_constant<bool, is_pod<_Tp>::value> { }; + + template<typename _Tp> + struct has_trivial_default_constructor + : public integral_constant<bool, is_pod<_Tp>::value> { }; + + template<typename _Tp> + struct has_trivial_copy_constructor + : public integral_constant<bool, is_pod<_Tp>::value> { }; + +_GLIBCXX_END_NAMESPACE + #endif diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index c824ef77a31..41edc3adbc0 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -37,7 +37,7 @@ #pragma GCC system_header #include <bits/c++config.h> -#include <tr1/type_traits_fwd.h> +#include <tr1/type_traitsfwd.h> // namespace std::tr1 namespace std diff --git a/libstdc++-v3/include/tr1/type_traits_fwd.h b/libstdc++-v3/include/tr1/type_traitsfwd.h index c6e80a3a4b9..497801447b1 100644 --- a/libstdc++-v3/include/tr1/type_traits_fwd.h +++ b/libstdc++-v3/include/tr1/type_traitsfwd.h @@ -27,13 +27,13 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -/** @file tr1/type_traits_fwd.h +/** @file tr1/type_traitsfwd.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ -#ifndef _TYPE_TRAITS_FWD_H -#define _TYPE_TRAITS_FWD_H 1 +#ifndef _TYPE_TRAITSFWD_H +#define _TYPE_TRAIT_FWD_H 1 #include <cstddef> diff --git a/libstdc++-v3/testsuite/20_util/conditional/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/conditional/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..079d366590e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/conditional/requirements/explicit_instantiation.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct conditional<true, test_type, test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc new file mode 100644 index 00000000000..980cd6dd986 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::conditional; + + typedef conditional<true, char, int>::type test1_type; + VERIFY( (std::is_same<test1_type, char>::value) ); + + typedef conditional<false, char, int>::type test2_type; + VERIFY( (std::is_same<test2_type, int>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/decay/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/decay/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..d804d11ffb8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/decay/requirements/explicit_instantiation.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct decay<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc new file mode 100644 index 00000000000..162ddd2ff42 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstdlib> +#include <type_traits> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::decay; + using std::is_same; + + // Positive tests. + typedef decay<bool>::type test1_type; + VERIFY( (is_same<test1_type, bool>::value) ); + + typedef decay<const int>::type test2_type; + VERIFY( (is_same<test2_type, const int>::value) ); + + typedef decay<int[4]>::type test3_type; + VERIFY( (is_same<test3_type, std::remove_extent<int[4]>::type*>::value) ); + + typedef void (fn_type) (); + typedef decay<fn_type>::type test4_type; + VERIFY( (is_same<test4_type, std::add_pointer<fn_type>::type>::value) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/enable_if/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/enable_if/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..f236eabadfc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/enable_if/requirements/explicit_instantiation.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct enable_if<true>; +} diff --git a/libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs.cc new file mode 100644 index 00000000000..34deb210354 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::enable_if; + + // Positive tests. + typedef enable_if<true, int>::type test1_type; +} diff --git a/libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs_neg.cc new file mode 100644 index 00000000000..daff6ad3fb4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs_neg.cc @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::enable_if; + + // Negative tests. + typedef enable_if<false, int>::type test2_type; +} + +// { dg-error "does not name a type" "" { target *-*-* } 33 } diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..dff484e9d6e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct has_nothrow_copy_constructor<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc new file mode 100644 index 00000000000..02c30d9f3aa --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// +// 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::has_nothrow_copy_constructor<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/has_nothrow_copy_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc new file mode 100644 index 00000000000..ac793178ac5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::has_nothrow_copy_constructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_nothrow_copy_constructor, void>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, float>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, EnumType>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int*>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int[2]>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, float[][3]>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int*[3]>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_nothrow_copy_constructor, + int (ClassType::*[][2][3]) (int)>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..e56d7090bf8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct has_nothrow_default_constructor<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc new file mode 100644 index 00000000000..6eeb6f06501 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-29 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// +// 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::has_nothrow_default_constructor<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/has_nothrow_default_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc new file mode 100644 index 00000000000..fccbcf74d28 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc @@ -0,0 +1,59 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-29 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 4.5.3 Type properties + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::has_nothrow_default_constructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_nothrow_default_constructor, void>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, float>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, EnumType>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int*>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int[2]>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, float[][3]>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int*[3]>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, + int (ClassType::*[][2][3]) (int)>(true)) ); + VERIFY( (test_category<has_nothrow_default_constructor, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..a6bb87dc7c3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct has_trivial_copy_constructor<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc new file mode 100644 index 00000000000..7b49ff3ed2e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// +// 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::has_trivial_copy_constructor<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/has_trivial_copy_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc new file mode 100644 index 00000000000..2ea418a2e9c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-30 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 4.5.3 Type properties + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::has_trivial_copy_constructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_trivial_copy_constructor, void>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, float>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, EnumType>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int*>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int[2]>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, float[][3]>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int*[3]>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_trivial_copy_constructor, + int (ClassType::*[][2][3]) (int)>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..03b3050495e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct has_trivial_default_constructor<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc new file mode 100644 index 00000000000..af8e7265532 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// +// 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::has_trivial_default_constructor<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/has_trivial_default_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc new file mode 100644 index 00000000000..fae5ace9f76 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc @@ -0,0 +1,59 @@ +// { dg-options "-std=gnu++0x" } +// 2004-12-26 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2004, 2005, 2006, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 4.5.3 Type properties + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::has_trivial_default_constructor; + using namespace __gnu_test; + + VERIFY( (test_category<has_trivial_default_constructor, void>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, float>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, EnumType>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int*>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int(*)(int)>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int (ClassType::*)>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, + int (ClassType::*) (int)>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int[2]>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, float[][3]>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, EnumType[2][3][4]>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int*[3]>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, int(*[][2])(int)>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, + int (ClassType::*[2][3])>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, + int (ClassType::*[][2][3]) (int)>(true)) ); + VERIFY( (test_category<has_trivial_default_constructor, ClassType>(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc new file mode 100644 index 00000000000..37c5a0346d1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> + +namespace gnu +{ + // C++0x changes from TR1. + using std::has_trivial_constructor; + using std::has_nothrow_constructor; + using std::has_trivial_copy; + using std::has_nothrow_copy; +} + +// { dg-error "has not been declared" "" { target *-*-* } 27 } +// { dg-error "has not been declared" "" { target *-*-* } 28 } +// { dg-error "has not been declared" "" { target *-*-* } 29 } +// { dg-error "has not been declared" "" { target *-*-* } 30 } + diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..ca0ed884051 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/explicit_instantiation.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct make_signed<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs.cc new file mode 100644 index 00000000000..826e47ed3e8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs.cc @@ -0,0 +1,68 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_hooks.h> + +enum test_enum { first_selection }; + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::make_signed; + using std::is_same; + + // Positive tests. + typedef make_signed<const int>::type test2_type; + VERIFY( (is_same<test2_type, const int>::value) ); + + typedef make_signed<const unsigned int>::type test21c_type; + VERIFY( (is_same<test21c_type, const signed int>::value) ); + + typedef make_signed<volatile unsigned int>::type test21v_type; + VERIFY( (is_same<test21v_type, volatile signed int>::value) ); + + typedef make_signed<const volatile unsigned int>::type test21cv_type; + VERIFY( (is_same<test21cv_type, const volatile signed int>::value) ); + + typedef make_signed<const char>::type test22_type; + VERIFY( (is_same<test22_type, const signed char>::value) ); + + typedef make_signed<volatile wchar_t>::type test23_type; + VERIFY( (is_same<test23_type, volatile signed wchar_t>::value) ); + +#if 0 + // XXX + // When is_signed works for floating points types this should pass + typedef make_signed<volatile float>::type test24_type; + VERIFY( (is_same<test24_type, volatile int>::value) ); +#endif + + typedef make_signed<test_enum>::type test25_type; + VERIFY( (is_same<test25_type, int>::value) ); +} + +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 new file mode 100644 index 00000000000..aa94f2a4708 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -0,0 +1,53 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_character.h> + +enum test_enum { first_selection }; + +void test01() +{ + using std::make_signed; + + // Negative tests. + typedef make_signed<bool>::type test1_type; + + typedef make_signed<__gnu_test::pod_uint>::type test2_type; + + typedef make_signed<int[4]>::type test3_type; + + typedef void (fn_type) (); + typedef make_signed<fn_type>::type test4_type; +} + +// { dg-error "does not name a type" "" { target *-*-* } 34 } +// { dg-error "instantiated from here" "" { target *-*-* } 36 } +// { dg-error "instantiated from here" "" { target *-*-* } 38 } +// { dg-error "instantiated from here" "" { target *-*-* } 41 } + +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 320 } +// { dg-error "declaration of" "" { target *-*-* } 268 } + +// { dg-excess-errors "At global scope" } +// { dg-excess-errors "In instantiation of" } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..bc836a7d64a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/explicit_instantiation.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct make_unsigned<test_type>; +} diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs.cc new file mode 100644 index 00000000000..b09d3e93aa4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs.cc @@ -0,0 +1,68 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_hooks.h> + +enum test_enum { first_selection }; + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::make_unsigned; + using std::is_same; + + // Positive tests. + typedef make_unsigned<const unsigned int>::type test2_type; + VERIFY( (is_same<test2_type, const unsigned int>::value) ); + + typedef make_unsigned<const signed int>::type test21c_type; + VERIFY( (is_same<test21c_type, const unsigned int>::value) ); + + typedef make_unsigned<volatile signed int>::type test21v_type; + VERIFY( (is_same<test21v_type, volatile unsigned int>::value) ); + + typedef make_unsigned<const volatile signed int>::type test21cv_type; + VERIFY( (is_same<test21cv_type, const volatile unsigned int>::value) ); + + typedef make_unsigned<const char>::type test22_type; + VERIFY( (is_same<test22_type, const unsigned char>::value) ); + + typedef make_unsigned<volatile wchar_t>::type test23_type; + VERIFY( (is_same<test23_type, volatile unsigned wchar_t>::value) ); + +#if 0 + // XXX + // When is_unsigned works for floating points types this should pass + typedef make_unsigned<volatile float>::type test24_type; + VERIFY( (is_same<test24_type, volatile unsigned int>::value) ); +#endif + + typedef make_unsigned<test_enum>::type test25_type; + VERIFY( (is_same<test25_type, unsigned int>::value) ); +} + +int main() +{ + test01(); + return 0; +} 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 new file mode 100644 index 00000000000..cc07d616954 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -0,0 +1,53 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_character.h> + +enum test_enum { first_selection }; + +void test01() +{ + using std::make_unsigned; + + // Negative tests. + typedef make_unsigned<bool>::type test1_type; + + typedef make_unsigned<__gnu_test::pod_uint>::type test2_type; + + typedef make_unsigned<int[4]>::type test3_type; + + typedef void (fn_type) (); + typedef make_unsigned<fn_type>::type test4_type; +} + +// { dg-error "does not name a type" "" { target *-*-* } 34 } +// { dg-error "instantiated from here" "" { target *-*-* } 36 } +// { dg-error "instantiated from here" "" { target *-*-* } 38 } +// { dg-error "instantiated from here" "" { target *-*-* } 41 } + +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 223 } +// { dg-error "declaration of" "" { target *-*-* } 170 } + +// { dg-excess-errors "At global scope" } +// { dg-excess-errors "In instantiation of" } diff --git a/libstdc++-v3/testsuite/23_containers/tuple/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc index cdead8f1ead..cdead8f1ead 100644 --- a/libstdc++-v3/testsuite/23_containers/tuple/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc |