This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Really weird build problem: please help
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 28 Jun 2004 20:24:16 +0200
- Subject: Re: Really weird build problem: please help
- References: <40E03EAC.1030405@suse.de> <40E049A5.1020306@suse.de>
Paolo Carlini wrote:
A little bit of progress: ios_init.cc compiles again if I comment out
this part
of cpp_type_traits.h:
namespace __gnu_internal
{
typedef char __one;
typedef char __two[2];
template <typename _Tp>
__one __test_type (int _Tp::*);
template <typename _Tp>
__two& __test_type (...);
}
Ok, I got it: namespace __gnu_internal was opened to add all that helper
stuff
*inside* namespace std! Indeed, the below fixes the problem. I'm finishing
regtesting (with the problem-triggering one-liner installed) and will commit
in case of success (also took the occasion to do some formatting fixes).
Paolo.
////////////////
2004-06-28 Paolo Carlini <pcarlini@suse.de>
* include/bits/cpp_type_traits.h: Move the additions to
namespace __gnu_internal outside of namespace std; trivial
formatting fixes.
diff -urN libstdc++-v3-orig/include/bits/cpp_type_traits.h libstdc++-v3/include/bits/cpp_type_traits.h
--- libstdc++-v3-orig/include/bits/cpp_type_traits.h 2004-03-26 01:38:56.000000000 +0100
+++ libstdc++-v3/include/bits/cpp_type_traits.h 2004-06-28 20:14:46.000000000 +0200
@@ -1,6 +1,6 @@
// The -*- C++ -*- type traits classes for internal use in libstdc++
-// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2004 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
@@ -64,6 +64,19 @@
// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
//
+// NB: g++ can not compile these if declared within the class
+// __is_pod itself.
+namespace __gnu_internal
+{
+ typedef char __one;
+ typedef char __two[2];
+
+ template <typename _Tp>
+ __one __test_type (int _Tp::*);
+ template <typename _Tp>
+ __two& __test_type (...);
+} // namespace __gnu_internal
+
namespace std
{
// Compare for equality of types.
@@ -71,18 +84,18 @@
struct __are_same
{
enum
- {
- _M_type = 0
- };
+ {
+ _M_type = 0
+ };
};
template<typename _Tp>
struct __are_same<_Tp, _Tp>
{
enum
- {
- _M_type = 1
- };
+ {
+ _M_type = 1
+ };
};
// Define a nested type if some predicate holds.
@@ -92,7 +105,7 @@
};
template<typename _Tp>
- struct __enable_if<_Tp, true>
+ struct __enable_if<_Tp, true>
{
typedef _Tp _M_type;
};
@@ -102,18 +115,18 @@
struct __is_void
{
enum
- {
- _M_type = 0
- };
+ {
+ _M_type = 0
+ };
};
template<>
struct __is_void<void>
{
enum
- {
- _M_type = 1
- };
+ {
+ _M_type = 1
+ };
};
//
@@ -123,9 +136,9 @@
struct __is_integer
{
enum
- {
- _M_type = 0
- };
+ {
+ _M_type = 0
+ };
};
// Thirteen specializations (yes there are eleven standard integer
@@ -135,213 +148,198 @@
struct __is_integer<bool>
{
enum
- {
- _M_type = 1
- };
+ {
+ _M_type = 1
+ };
};
template<>
struct __is_integer<char>
{
enum
- {
- _M_type = 1
- };
+ {
+ _M_type = 1
+ };
};
template<>
struct __is_integer<signed char>
{
enum
- {
- _M_type = 1
- };
+ {
+ _M_type = 1
+ };
};
template<>
- struct __is_integer<unsigned char>
- {
- enum
+ struct __is_integer<unsigned char>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
# ifdef _GLIBCXX_USE_WCHAR_T
template<>
- struct __is_integer<wchar_t>
- {
- enum
+ struct __is_integer<wchar_t>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
# endif
template<>
- struct __is_integer<short>
- {
- enum
+ struct __is_integer<short>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<unsigned short>
- {
- enum
+ struct __is_integer<unsigned short>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<int>
- {
- enum
+ struct __is_integer<int>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<unsigned int>
- {
- enum
+ struct __is_integer<unsigned int>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<long>
- {
- enum
+ struct __is_integer<long>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<unsigned long>
- {
- enum
+ struct __is_integer<unsigned long>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<long long>
- {
- enum
+ struct __is_integer<long long>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_integer<unsigned long long>
- {
- enum
+ struct __is_integer<unsigned long long>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
//
// Floating point types
//
template<typename _Tp>
- struct __is_floating
- {
- enum
+ struct __is_floating
{
- _M_type = 0
+ enum
+ {
+ _M_type = 0
+ };
};
- };
// three specializations (float, double and 'long double')
template<>
- struct __is_floating<float>
- {
- enum
+ struct __is_floating<float>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_floating<double>
- {
- enum
+ struct __is_floating<double>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
template<>
- struct __is_floating<long double>
- {
- enum
+ struct __is_floating<long double>
{
- _M_type = 1
+ enum
+ {
+ _M_type = 1
+ };
};
- };
//
// An arithmetic type is an integer type or a floating point type
//
template<typename _Tp>
- struct __is_arithmetic
- {
- enum
+ struct __is_arithmetic
{
- _M_type = __is_integer<_Tp>::_M_type || __is_floating<_Tp>::_M_type
+ enum
+ {
+ _M_type = __is_integer<_Tp>::_M_type || __is_floating<_Tp>::_M_type
+ };
};
- };
-
+
//
// A fundamental type is `void' or and arithmetic type
//
template<typename _Tp>
- struct __is_fundamental
- {
- enum
+ struct __is_fundamental
{
- _M_type = __is_void<_Tp>::_M_type || __is_arithmetic<_Tp>::_M_type
+ enum
+ {
+ _M_type = __is_void<_Tp>::_M_type || __is_arithmetic<_Tp>::_M_type
+ };
};
- };
//
// For the immediate use, the following is a good approximation
//
-
- // NB: g++ can not compile these if declared within the class
- // __is_pod itself.
- namespace __gnu_internal
- {
- typedef char __one;
- typedef char __two[2];
-
- template <typename _Tp>
- __one __test_type (int _Tp::*);
- template <typename _Tp>
- __two& __test_type (...);
- }
-
-
template<typename _Tp>
- struct __is_pod
- {
- enum
+ struct __is_pod
{
- _M_type = (sizeof(__gnu_internal::__test_type<_Tp>(0)) != sizeof(__gnu_internal::__one))
+ enum
+ {
+ _M_type = (sizeof(__gnu_internal::__test_type<_Tp>(0))
+ != sizeof(__gnu_internal::__one))
+ };
};
- };
} // namespace std
-
#endif //_CPP_TYPE_TRAITS_H