------- Comment #6 from d dot frey at gmx dot de 2009-03-13 12:49 ------- (In reply to comment #5)
More information on this: > > > The bug is in both 4.3.3 and 4.3.2, however it isn't in 4.3.0 on a > > > sparcv9-sun-solaris2.10 box with 64bits. Haven't got any 4.3.1 to try. I've copied to header from said machine on my Ubuntu machine. Colin's test case fails with Ubuntu's current version of GCC 4.3.2. Then I replaced /use/include/c++/4.3.2/tr1_impl/type_traits with the header from 4.3.0 and the test case passes. Hence, it *is* a library change. Regards, Daniel PS: The relevant chunk of the diff between the two headers: --- /home/frey/type_traits 2009-03-13 13:00:54.000000000 +0100 +++ /usr/include/c++/4.3.2/tr1_impl/type_traits 2009-01-24 07:11:38.000000000 +0100 @@ -125,78 +132,94 @@ struct is_array<_Tp[]> : public true_type { }; + /// is_pointer template<typename> struct is_pointer : public false_type { }; _DEFINE_SPEC(1, is_pointer, _Tp*, true) + /// is_reference template<typename _Tp> struct is_reference; + /// is_function template<typename _Tp> struct is_function; + /// is_member_object_pointer template<typename> struct is_member_object_pointer : public false_type { }; _DEFINE_SPEC(2, is_member_object_pointer, _Tp _Cp::*, !is_function<_Tp>::value) + /// is_member_function_pointer template<typename> struct is_member_function_pointer : public false_type { }; _DEFINE_SPEC(2, is_member_function_pointer, _Tp _Cp::*, is_function<_Tp>::value) + /// is_enum template<typename _Tp> struct is_enum : public integral_constant<bool, __is_enum(_Tp)> { }; + /// is_union template<typename _Tp> struct is_union : public integral_constant<bool, __is_union(_Tp)> { }; + /// is_class template<typename _Tp> struct is_class : public integral_constant<bool, __is_class(_Tp)> { }; - template<typename> - struct __is_function_helper - : public false_type { }; - - template<typename _Res, typename... _ArgTypes> - struct __is_function_helper<_Res(_ArgTypes...)> - : public true_type { }; - - template<typename _Res, typename... _ArgTypes> - struct __is_function_helper<_Res(_ArgTypes......)> - : public true_type { }; + template<typename _Tp> + struct __in_array + : public __sfinae_types + { + private: + template<typename _Up> + static __one __test(_Up(*)[1]); + template<typename> + static __two __test(...); + + public: + static const bool __value = sizeof(__test<_Tp>(0)) == 1; + }; + /// is_abstract template<typename _Tp> - struct remove_cv; + struct is_abstract; + /// is_function template<typename _Tp> struct is_function - : public integral_constant<bool, (__is_function_helper<typename - remove_cv<_Tp>::type>::value)> + : public integral_constant<bool, !(__in_array<_Tp>::__value + || is_abstract<_Tp>::value + || is_reference<_Tp>::value + || is_void<_Tp>::value)> { }; - /// @brief composite type traits [4.5.2]. + /// composite type traits [4.5.2]. template<typename _Tp> struct is_arithmetic : public integral_constant<bool, (is_integral<_Tp>::value || is_floating_point<_Tp>::value)> { }; + /// is_fundamental template<typename _Tp> struct is_fundamental : public integral_constant<bool, (is_arithmetic<_Tp>::value || is_void<_Tp>::value)> { }; + /// is_object template<typename _Tp> struct is_object : public integral_constant<bool, !(is_function<_Tp>::value -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39405