type_traits (enable_if): New.
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 3 May 2007 11:49:12 +0000 (11:49 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 3 May 2007 11:49:12 +0000 (11:49 +0000)
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.

From-SVN: r124374

35 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/tr1/type_traits
libstdc++-v3/include/tr1/type_traits_fwd.h [deleted file]
libstdc++-v3/include/tr1/type_traitsfwd.h [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/conditional/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/decay/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/enable_if/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/enable_if/requirements/typedefs_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_nothrow_copy_constructor/value.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_nothrow_default_constructor/value.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_signed/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/tuple/requirements/explicit_instantiation.cc [deleted file]

index 1aee8b0baf8da03a4d6cd6b1d261e3a281fe7104..48a0494cb5bd108df6a8664a6cb32504f4169fe7 100644 (file)
@@ -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
index 75be19a5f7865d77f20bfa9ae6fb313ecf008cdc..ea27464432e92adb40d7d8bafd5daeeebf3e1d30 100644 (file)
@@ -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 \
index 5b4ad599218c734d186df280b8f695884cfe0481..4402d84c67ffc2a57c0aeff7721d431f6dd5a888 100644 (file)
@@ -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 \
index 1d83dabd861575f477e2999c20d2127e69ae5b00..0d7e85e5300054e6b79c4e43c1bef7514b19563c 100644 (file)
 # 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 
 
index c824ef77a31c44737590dcf410c459e04c63fbe1..41edc3adbc0ec187cf48091adc288aaa4b1afce8 100644 (file)
@@ -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_traits_fwd.h
deleted file mode 100644 (file)
index c6e80a3..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-// TR1 type_traits -*- C++ -*-
-
-// 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.
-
-// 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.
-
-/** @file tr1/type_traits_fwd.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
-
-#include <cstddef>
-
-// namespace std::tr1
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
-
-  /// @brief  helper classes [4.3].
-  template<typename _Tp, _Tp __v>
-    struct integral_constant;
-  typedef integral_constant<bool, true>     true_type;
-  typedef integral_constant<bool, false>    false_type;
-
-  /// @brief  primary type categories [4.5.1].
-  template<typename _Tp>
-    struct is_void;
-
-  template<typename _Tp>
-    struct is_integral;
-
-  template<typename _Tp>
-    struct is_floating_point;
-
-  template<typename _Tp>
-    struct is_array;
-  
-  template<typename _Tp>
-    struct is_pointer;
-  template<typename _Tp>
-    struct is_reference;
-
-  template<typename _Tp>
-    struct is_member_object_pointer;
-  
-  template<typename _Tp>
-    struct is_member_function_pointer;   
-
-  template<typename _Tp>
-    struct is_enum;
-  
-  template<typename _Tp>
-    struct is_union;
-  
-  template<typename _Tp>
-    struct is_class;
-
-  template<typename _Tp>
-    struct is_function;
-
-  /// @brief  composite type traits [4.5.2].
-  template<typename _Tp>
-    struct is_arithmetic;
-
-  template<typename _Tp>
-    struct is_fundamental;
-
-  template<typename _Tp>
-    struct is_object;
-
-  template<typename _Tp>
-    struct is_scalar;
-
-  template<typename _Tp>
-    struct is_compound;
-
-  template<typename _Tp>
-    struct is_member_pointer;
-
-  /// @brief  type properties [4.5.3].
-  template<typename _Tp>
-    struct is_const;
-  
-  template<typename _Tp>
-    struct is_volatile;
-
-  template<typename _Tp>
-    struct is_pod;
-  
-  template<typename _Tp>
-    struct is_empty;
-  
-  template<typename _Tp>
-    struct is_polymorphic;
-  
-  template<typename _Tp>
-    struct is_abstract;
-  
-  template<typename _Tp>
-    struct has_trivial_constructor;
-  
-  template<typename _Tp>
-    struct has_trivial_copy;
-
-  template<typename _Tp>
-    struct has_trivial_assign;
-  
-  template<typename _Tp>
-    struct has_trivial_destructor;
-  
-  template<typename _Tp>
-    struct has_nothrow_constructor;
-  
-  template<typename _Tp>
-    struct has_nothrow_copy;
-
-  template<typename _Tp>
-    struct has_nothrow_assign;
-  
-  template<typename _Tp>
-    struct has_virtual_destructor;
-  
-  template<typename _Tp>
-    struct is_signed;
-  
-  template<typename _Tp>
-    struct is_unsigned;
-   
-  template<typename _Tp>
-    struct alignment_of;
-  
-  template<typename _Tp>
-    struct rank;
-  
-  template<typename _Tp, unsigned _Uint = 0>
-    struct extent;
-  
-  /// @brief  relationships between types [4.6].
-  template<typename _Tp, typename _Up>
-    struct is_same;
-
-  template<typename _From, typename _To>
-    struct is_convertible;
-
-  template<typename _Base, typename _Derived>
-    struct is_base_of;
-
-  /// @brief  const-volatile modifications [4.7.1].
-  template<typename _Tp>
-    struct remove_const;
-  
-  template<typename _Tp>
-    struct remove_volatile;
-  
-  template<typename _Tp>
-    struct remove_cv;
-  
-  template<typename _Tp>
-    struct add_const;
-   
-  template<typename _Tp>
-    struct add_volatile;
-  
-  template<typename _Tp>
-    struct add_cv;
-
-  /// @brief  reference modifications [4.7.2].
-  template<typename _Tp>
-    struct remove_reference;
-  
-  template<typename _Tp>
-    struct add_reference;
-
-  /// @brief  array modifications [4.7.3].
-  template<typename _Tp>
-    struct remove_extent;
-
-  template<typename _Tp>
-    struct remove_all_extents;
-
-  /// @brief  pointer modifications [4.7.4].
-  template<typename _Tp>
-    struct remove_pointer;
-  
-  template<typename _Tp>
-    struct add_pointer;
-
-  /// @brief  other transformations [4.8].
-  template<std::size_t _Len, std::size_t _Align>
-    struct aligned_storage;
-
-_GLIBCXX_END_NAMESPACE
-}
-
-#endif
diff --git a/libstdc++-v3/include/tr1/type_traitsfwd.h b/libstdc++-v3/include/tr1/type_traitsfwd.h
new file mode 100644 (file)
index 0000000..4978014
--- /dev/null
@@ -0,0 +1,222 @@
+// TR1 type_traits -*- C++ -*-
+
+// 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.
+
+// 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.
+
+/** @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_TRAITSFWD_H
+#define _TYPE_TRAIT_FWD_H 1
+
+#include <cstddef>
+
+// namespace std::tr1
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
+
+  /// @brief  helper classes [4.3].
+  template<typename _Tp, _Tp __v>
+    struct integral_constant;
+  typedef integral_constant<bool, true>     true_type;
+  typedef integral_constant<bool, false>    false_type;
+
+  /// @brief  primary type categories [4.5.1].
+  template<typename _Tp>
+    struct is_void;
+
+  template<typename _Tp>
+    struct is_integral;
+
+  template<typename _Tp>
+    struct is_floating_point;
+
+  template<typename _Tp>
+    struct is_array;
+  
+  template<typename _Tp>
+    struct is_pointer;
+  template<typename _Tp>
+    struct is_reference;
+
+  template<typename _Tp>
+    struct is_member_object_pointer;
+  
+  template<typename _Tp>
+    struct is_member_function_pointer;   
+
+  template<typename _Tp>
+    struct is_enum;
+  
+  template<typename _Tp>
+    struct is_union;
+  
+  template<typename _Tp>
+    struct is_class;
+
+  template<typename _Tp>
+    struct is_function;
+
+  /// @brief  composite type traits [4.5.2].
+  template<typename _Tp>
+    struct is_arithmetic;
+
+  template<typename _Tp>
+    struct is_fundamental;
+
+  template<typename _Tp>
+    struct is_object;
+
+  template<typename _Tp>
+    struct is_scalar;
+
+  template<typename _Tp>
+    struct is_compound;
+
+  template<typename _Tp>
+    struct is_member_pointer;
+
+  /// @brief  type properties [4.5.3].
+  template<typename _Tp>
+    struct is_const;
+  
+  template<typename _Tp>
+    struct is_volatile;
+
+  template<typename _Tp>
+    struct is_pod;
+  
+  template<typename _Tp>
+    struct is_empty;
+  
+  template<typename _Tp>
+    struct is_polymorphic;
+  
+  template<typename _Tp>
+    struct is_abstract;
+  
+  template<typename _Tp>
+    struct has_trivial_constructor;
+  
+  template<typename _Tp>
+    struct has_trivial_copy;
+
+  template<typename _Tp>
+    struct has_trivial_assign;
+  
+  template<typename _Tp>
+    struct has_trivial_destructor;
+  
+  template<typename _Tp>
+    struct has_nothrow_constructor;
+  
+  template<typename _Tp>
+    struct has_nothrow_copy;
+
+  template<typename _Tp>
+    struct has_nothrow_assign;
+  
+  template<typename _Tp>
+    struct has_virtual_destructor;
+  
+  template<typename _Tp>
+    struct is_signed;
+  
+  template<typename _Tp>
+    struct is_unsigned;
+   
+  template<typename _Tp>
+    struct alignment_of;
+  
+  template<typename _Tp>
+    struct rank;
+  
+  template<typename _Tp, unsigned _Uint = 0>
+    struct extent;
+  
+  /// @brief  relationships between types [4.6].
+  template<typename _Tp, typename _Up>
+    struct is_same;
+
+  template<typename _From, typename _To>
+    struct is_convertible;
+
+  template<typename _Base, typename _Derived>
+    struct is_base_of;
+
+  /// @brief  const-volatile modifications [4.7.1].
+  template<typename _Tp>
+    struct remove_const;
+  
+  template<typename _Tp>
+    struct remove_volatile;
+  
+  template<typename _Tp>
+    struct remove_cv;
+  
+  template<typename _Tp>
+    struct add_const;
+   
+  template<typename _Tp>
+    struct add_volatile;
+  
+  template<typename _Tp>
+    struct add_cv;
+
+  /// @brief  reference modifications [4.7.2].
+  template<typename _Tp>
+    struct remove_reference;
+  
+  template<typename _Tp>
+    struct add_reference;
+
+  /// @brief  array modifications [4.7.3].
+  template<typename _Tp>
+    struct remove_extent;
+
+  template<typename _Tp>
+    struct remove_all_extents;
+
+  /// @brief  pointer modifications [4.7.4].
+  template<typename _Tp>
+    struct remove_pointer;
+  
+  template<typename _Tp>
+    struct add_pointer;
+
+  /// @brief  other transformations [4.8].
+  template<std::size_t _Len, std::size_t _Align>
+    struct aligned_storage;
+
+_GLIBCXX_END_NAMESPACE
+}
+
+#endif
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 (file)
index 0000000..079d366
--- /dev/null
@@ -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 (file)
index 0000000..980cd6d
--- /dev/null
@@ -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 (file)
index 0000000..d804d11
--- /dev/null
@@ -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 (file)
index 0000000..162ddd2
--- /dev/null
@@ -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 (file)
index 0000000..f236eab
--- /dev/null
@@ -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 (file)
index 0000000..34deb21
--- /dev/null
@@ -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 (file)
index 0000000..daff6ad
--- /dev/null
@@ -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 (file)
index 0000000..dff484e
--- /dev/null
@@ -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 (file)
index 0000000..02c30d9
--- /dev/null
@@ -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 (file)
index 0000000..ac79317
--- /dev/null
@@ -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 (file)
index 0000000..e56d709
--- /dev/null
@@ -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 (file)
index 0000000..6eeb6f0
--- /dev/null
@@ -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 (file)
index 0000000..fccbcf7
--- /dev/null
@@ -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 (file)
index 0000000..a6bb87d
--- /dev/null
@@ -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 (file)
index 0000000..7b49ff3
--- /dev/null
@@ -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 (file)
index 0000000..2ea418a
--- /dev/null
@@ -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 (file)
index 0000000..03b3050
--- /dev/null
@@ -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 (file)
index 0000000..af8e726
--- /dev/null
@@ -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 (file)
index 0000000..fae5ace
--- /dev/null
@@ -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 (file)
index 0000000..37c5a03
--- /dev/null
@@ -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 (file)
index 0000000..ca0ed88
--- /dev/null
@@ -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 (file)
index 0000000..826e47e
--- /dev/null
@@ -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 (file)
index 0000000..aa94f2a
--- /dev/null
@@ -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 (file)
index 0000000..bc836a7
--- /dev/null
@@ -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 (file)
index 0000000..b09d3e9
--- /dev/null
@@ -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 (file)
index 0000000..cc07d61
--- /dev/null
@@ -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/20_util/tuple/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc
new file mode 100644 (file)
index 0000000..cdead8f
--- /dev/null
@@ -0,0 +1,33 @@
+// { 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.
+
+// 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.
+
+#include <tr1/tuple>
+
+template class std::tuple<short, int, double>;
diff --git a/libstdc++-v3/testsuite/23_containers/tuple/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/tuple/requirements/explicit_instantiation.cc
deleted file mode 100644 (file)
index cdead8f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// { 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.
-
-// 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.
-
-#include <tr1/tuple>
-
-template class std::tuple<short, int, double>;