Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2003-12-30 08:32:46


The following patch gets the octonion / quaternion tests building with
gcc3.3 (the using declaration changes appear to be a gcc bug, the
static_cast changes appear to be required for classes with explicit
constructors as is the case here):

cvs server: Diffing .
cvs server: Diffing special_functions
Index: special_functions/sinc.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/math/special_functions/sinc.hpp,v
retrieving revision 1.8
diff -b -u -r1.8 sinc.hpp
--- special_functions/sinc.hpp 1 Mar 2003 18:09:53 -0000 1.8
+++ special_functions/sinc.hpp 30 Dec 2003 13:25:18 -0000
@@ -91,7 +91,9 @@
         template<typename T, template<typename> class U>
         inline U<T> sinc_pi(const U<T> x)
         {
-#ifdef BOOST_NO_STDC_NAMESPACE
+#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) ||
defined(__GNUC__)
+ using namespace std;
+#elif defined(BOOST_NO_STDC_NAMESPACE)
             using ::abs;
             using ::sin;
             using ::sqrt;
@@ -114,7 +116,7 @@
             else
             {
                 // approximation by taylor series in x at 0 up to order 0
- U<T> result = static_cast< U<T> >(1);
+ U<T> result = U<T>(1);

                 if (abs(x) >= taylor_0_bound)
                 {
Index: special_functions/sinhc.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/math/special_functions/sinhc.hpp,v
retrieving revision 1.8
diff -b -u -r1.8 sinhc.hpp
--- special_functions/sinhc.hpp 1 Mar 2003 18:09:53 -0000 1.8
+++ special_functions/sinhc.hpp 30 Dec 2003 13:25:18 -0000
@@ -91,7 +91,9 @@
         template<typename T, template<typename> class U>
         inline U<T> sinhc_pi(const U<T> x)
         {
-#ifdef BOOST_NO_STDC_NAMESPACE
+#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) ||
defined(__GNUC__)
+ using namespace std;
+#elif defined(BOOST_NO_STDC_NAMESPACE)
             using ::abs;
             using ::sinh;
             using ::sqrt;
@@ -114,7 +116,7 @@
             else
             {
                 // approximation by taylor series in x at 0 up to order 0
- U<T> result = static_cast< U<T> >(1);
+ U<T> result = U<T>(1);

                 if (abs(x) >= taylor_0_bound)
                 {

However while these patches are harmless for vc7.1 (the only compiler
currently passing these tests I think, there are still runtime failures with
gcc:

execute-test
..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.run
====== BEGIN OUTPUT ======
Running 6 test cases...
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/octonion/octonion_test.cpp(703): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(toto)+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)

*** 7 failures detected in test suite "octonion_test"
====== END OUTPUT ======

..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.exe >
..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.output 2>&1 && copy
..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.output
..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.run || ( echo ====== BEGIN OUTPUT ====== && type
..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.output && echo ====== END OUTPUT ====== && exit 1 )

...failed execute-test
..\..\..\bin\boost\libs\math\test\octonion_test.test\gcc\debug\octonion_test
.run...
gcc-C++-action
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.obj
gcc-Link-action
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.exe
execute-test
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.run
====== BEGIN OUTPUT ======
Running 18 test cases...
../../../libs/math/quaternion/quaternion_test.cpp(576): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(::boost::math::quaternion<T>
(0,4*atan(static_cast<T>(1)),0,0))+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/quaternion/quaternion_test.cpp(583): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(::boost::math::quaternion<T>
(0,0,4*atan(static_cast<T>(1)),0))+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)
../../../libs/math/quaternion/quaternion_test.cpp(590): error in
"::boost::bind(static_cast < void (*) (const char *) >(&exp_test<long
double>), "long double")": test
::std::less_equal<T>()(abs(exp(::boost::math::quaternion<T>
(0,0,0,4*atan(static_cast<T>(1))))+static_cast<T>(1)),
2*numeric_limits<T>::epsilon()) failed for (1.22465e-16, 2.1684e-19)

*** 3 failures detected in test suite "quaternion_test"
====== END OUTPUT ======

..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.exe >
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.output 2>&1 && copy
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.output
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.run || ( echo ====== BEGIN OUTPUT ====== && type
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.output && echo ====== END OUTPUT ====== && exit 1 )

...failed execute-test
..\..\..\bin\boost\libs\math\test\quaternion_test.test\gcc\debug\quaternion_
test.run...

Which all look rather worrying, anyone any ideas what's going on here?

John.


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