Subject: [boost] [patch] lambda bug with GCC debug mode
From: Jonathan Wakely <[email-masked]>
To: [email-masked]
Date: Tue, 29 Mar 2005 09:39:17 +0100
List-Id: Boost developers' mailing list <boost.lists.boost.org>

The libstdc++ debug mode doesn't work with forward declarations of std
templates (since when using the debug mode std::vector is really
__gnu_debug_def::vector, visible in std due to GCC's "strong using"
extension)

Lambda's boost/lambda/detail/operator_return_type_traits.hpp seems to
account for this, but only checks for GCC 3.4 not 4.0, causing the
error shown here for GCC 4.x in debug mode (*):
http://www.redi.uklinux.net/src/boost/status/cs-Linux-links.html#lambda-constructor_tests-gcc-debug-mode

The workaround on line 876 should be changed to account for GCC 4.x or
alternatively, test for the debug mode explicitly.  The attached patch
does the test explicitly and disables all forward decls of std templates
when _GLIBCXX_DEBUG is defined.  I don't know whether it's preferred
to simply disable the forward decls for non-debug mode as well.

jon

(*) regression test results for GCC 4.0 & 4.1 on x86_64 GNU/Linux here:
http://www.redi.uklinux.net/src/boost/status/cs-Linux.html
All toolsets use GCC's concept-checks, the gcc-debug-mode toolset also
uses the libstdc++ debug mode.

-- 
"Always Read the Label"
	- anon.
Index: boost/lambda/detail/operator_return_type_traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/lambda/detail/operator_return_type_traits.hpp,v
retrieving revision 1.9
diff -u -p -r1.9 operator_return_type_traits.hpp
--- boost/lambda/detail/operator_return_type_traits.hpp	27 Jul 2004 03:43:27 -0000	1.9
+++ boost/lambda/detail/operator_return_type_traits.hpp	29 Mar 2005 08:35:03 -0000
@@ -858,9 +858,13 @@ struct return_type_2<other_action<subscr
 } // namespace boost

-namespace std {
- template <class Char, class Traits, class Allocator> class basic_string;
-}
+// Forward declarations are incompatible with the libstdc++ debug mode.
+#if BOOST_WORKAROUND(__GNUC__, >= 3) && _GLIBCXX_DEBUG
+#include <string>
+#include <vector>
+#include <map>
+#include <deque>
+#else
 
 // The GCC 2.95.x uses a non-conformant deque
 #if BOOST_WORKAROUND(__GNUC__, == 2) && __GNUC_MINOR__ <= 96
@@ -873,12 +877,8 @@ namespace std {
 
 #endif
 
-#if BOOST_WORKAROUND(__GNUC__, == 3) && __GNUC_MINOR__ >=4
-#include <vector>
-#include <map>
-#else
-
 namespace std {
+ template <class Char, class Traits, class Allocator> class basic_string;
  template <class T, class Allocator> class vector;
  template <class Key, class T, class Cmp, class Allocator> class map;
  template <class Key, class T, class Cmp, class Allocator> class multimap;
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost