Boost logo

Boost :

From: AlisdairM (alisdair.meredith_at_[hidden])
Date: 2006-11-19 04:53:01


This is another patch for a test case, as it is the test case that
exploits the Borland bug.

Essentially, BOOST_STATIC_CONSTANT cannot be used inside a member
template on this compiler, so we need to fall back on using an enum in
those cases.

Updating the test case with this workaround shows that Borland can use
the tested library correctly, so I would like to apply the patch to
both mainline and rc_1_34_0 branch.

-- 
AlisdairM
cvs diff -u -wb -- numeric_traits_test.cpp (in directory
E:\sourceforge\rc_1_34_0\boost\libs\utility\)
Index: numeric_traits_test.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/utility/numeric_traits_test.cpp,v
retrieving revision 1.13
diff -u -w -b -r1.13 numeric_traits_test.cpp
--- numeric_traits_test.cpp	8 Dec 2005 03:20:42 -0000	1.13
+++ numeric_traits_test.cpp	19 Nov 2006 09:37:34 -0000
@@ -86,8 +86,13 @@
     template <class Number>
     struct values
     {
+#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
+        enum { min = 0 };
+        enum { max = UCHAR_MAX };
+#else
         BOOST_STATIC_CONSTANT(Number, min = 0);
         BOOST_STATIC_CONSTANT(Number, max = UCHAR_MAX);
+#endif
     };
 };
 
@@ -96,8 +101,13 @@
     template <class Number>
     struct values
     {
+#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
+        enum { min = SCHAR_MIN };
+        enum { max = SCHAR_MAX };
+#else
         BOOST_STATIC_CONSTANT(Number, min = SCHAR_MIN);
         BOOST_STATIC_CONSTANT(Number, max = SCHAR_MAX);
+#endif
     };
 };
 
@@ -108,11 +118,17 @@
     template <class Number>
     struct traits
     {
+#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
+        enum { is_signed = boost::detail::is_signed<Number>::value ?
true : false };
+        enum { min = complement_base<is_signed>::template
values<Number>::min };
+        enum { max = complement_base<is_signed>::template
values<Number>::max };
+#else
         BOOST_STATIC_CONSTANT(bool, is_signed =
boost::detail::is_signed<Number>::value);
         BOOST_STATIC_CONSTANT(Number, min =
                             complement_base<is_signed>::template
values<Number>::min);
         BOOST_STATIC_CONSTANT(Number, max =
                             complement_base<is_signed>::template
values<Number>::max);
+#endif
     };
 };
 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk