[test] regressions with Borland and VC7

Hi, Starting yesterday, unit_test_suite.cpp fails to compile with Borland and VC71. Here are the errors I get (I just ran cvs update): ********** Borland 5.6.4 ********** borland-C++-action ..\..\..\bin\boost\libs\test\build\libboost_unit_test_framework.lib\borland\debu g\unit_test_suite.obj c:\documents and settings\turkanis\home\libraries\boost\libs\test\build\../src/unit_test_suite.cp p: Error E2268 C:\CBuilderX\include\stl/_algo.c 432: Call to undefined function 'rand' in function _STL::int __random_number<int>(int) *** 1 errors in Compile *** "bcc32" -j5 -g255 -q -c -P -w -Ve -Vx -a8 -b- -DBOOST_TEST_NO_AUTO_LINK=1 -v -Od -vi- -tWC -tWR -tWC -WM- -w-8080 -w-8001 -I"..\..\..\bin\boost\libs\test\b uild" -I"C:\Documents and ettings\turkanis\Home\Libraries\boost" -o"..\..\..\bin\boost\libs\test\build\li bboost_unit_test_framework.lib\borland\debug\unit_test_suite.obj" "C:\Documents and Settings\turkanis\Home\Libraries\boost\libs\test\build\../src/unit_test_suite.cp p" ...failed borland-C++-action ..\..\..\bin\boost\libs\test\build\libboost_unit_test_framework.lib\borland\debu g\unit_test_suite.obj... ********** VC 7.0 ********** vc-C++ ..\..\..\bin\boost\libs\test\build\libboost_unit_test_framework.lib\vc7\debug\th reading-multi\unit_test_suite.obj unit_test_suite.cpp C:\Documents and Settings\turkanis\Home\Libraries\boost\boost\test\impl\unit_test_suite.ipp(83) : error C2558: class 'boost::unit_test::callback0<R>' : no copy constructor available or copy constructor is declared 'explicit' with [ R=boost::unit_test::ut_detail::unused ] CALL "C:\PROGRA~1\MICROS~1.NET\VC7\bin\VCVARS32.BAT" >nul "C:\PROGRA~1\MICROS~1.NET\VC7\bin\cl" /Zm800 -nologo EHsc -c -DBOOST_TEST_NO_AUTO_LINK=1 /Z7 /Od /Ob0 /EHsc /GR /MDd /Op /Zc:forScope c:wchar_t -I"..\..\..\bin\boost\libs\test\build" -I"C:\Documents and Settings\turkanis\Home\Libraries\boost" -Fo"..\..\..\bin\boost\libs\test\build \libboost_unit_test_framework.lib\vc7\debug\threading-multi\unit_test_suite.obj" -Tp"C:\Documents and Settings\turkanis\Home\Libraries\boost\libs\test\build\../src/unit_test_suite.cp p" ..failed vc-C++ ..\..\..\bin\boost\libs\test\build\libboost_unit_test_framework.lib\c7\debug\thr eading-multi\unit_test_suite.obj... ************************** Jonathan

"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message news:cvg1v1$mq1$1@sea.gmane.org...
Hi,
Starting yesterday, unit_test_suite.cpp fails to compile with Borland and VC71. Here are the errors I get (I just ran cvs update):
********** Borland 5.6.4 **********
borland-C++-action
..\..\..\bin\boost\libs\test\build\libboost_unit_test_framework.lib\borland\ debu
g\unit_test_suite.obj c:\documents and
settings\turkanis\home\libraries\boost\libs\test\build\../src/unit_test_suit e.cp
p: Error E2268 C:\CBuilderX\include\stl/_algo.c 432: Call to undefined function 'rand' in function _STL::int __random_number<int>(int)
*** 1 errors in Compile ***
Well? What could I do about that? Is there any workarounds?
C:\Documents and
Settings\turkanis\Home\Libraries\boost\boost\test\impl\unit_test_suite.ipp(8 3) :
error C2558: class 'boost::unit_test::callback0<R>' : no copy constructor available or copy constructor is declared 'explicit' with [ R=boost::unit_test::ut_detail::unused ]
It does exist actually: callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {} This code works for MSVC 6.5 and MSVC 7.1. I do not have 7.0 at the moment? Could you try to see what could be done? I will try to check it myself, once I have an access to the compiler. Gennadiy

Gennadiy Rozental wrote:
"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message
It does exist actually:
callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {}
This code works for MSVC 6.5 and MSVC 7.1. I do not have 7.0 at the moment? Could you try to see what could be done? I will try to check it myself, once I have an access to the compiler.
Okay here is a fix. For VC7.0, the copy constructor can simply be conditionally removed. I assume the same should be done for the higher-arity callbacks. So a conservative solution would be: #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300) callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {} #endif However, I believe this copy constructor is unnecessary, since it is identical to the compiler generated copy-constructor, and the presence of the templated constructor should not inhibit the compiler-generated constructor. However, some broken compilers may not generate a copy-constructor in this case. I know that VC6 is one of them. So you could do #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {} #endif and similarly for the higher arities. I tested the second solution on VC6, VC7.0, VC7.1, GCC 3.4, Intel 8.0 (Windows), Codewarrior 8.3 and Borland 5.6.4. Jonathan

Gennadiy Rozental wrote:
This code works for MSVC 6.5 and MSVC 7.1. I do not have 7.0 at the moment? Could you try to see what could be done? I will try to check it myself, once I have an access to the compiler.
I'm happy to make either of the changes I suggested: 1. omit the copy constructor conditionally for VC7.0, or 2. include the copy constructor conditionally for VC6, the only compiler I know which needs the copy constructor I haven't committed anything because I thought you would like to choose the workaround. Jonathan

Gennadiy Rozental wrote:
This code works for MSVC 6.5 and MSVC 7.1. I do not have 7.0 at the moment? Could you try to see what could be done? I will try to check it myself, once I have an access to the compiler.
I'm happy to make either of the changes I suggested:
1. omit the copy constructor conditionally for VC7.0, or 2. include the copy constructor conditionally for VC6, the only compiler I know which needs the copy constructor
I haven't committed anything because I thought you would like to choose
"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message news:cvk21s$os0$1@sea.gmane.org... the
workaround.
Jonathan
Go ahead and commit solution 2. I still trying to figure out dll build. Gennadiy

Gennadiy Rozental wrote:
"Jonathan Turkanis" wrote:
I'm happy to make either of the changes I suggested:
1. omit the copy constructor conditionally for VC7.0, or 2. include the copy constructor conditionally for VC6, the only compiler I know which needs the copy constructor
I haven't committed anything because I thought you would like to choose the workaround.
Jonathan
Go ahead and commit solution 2. I still trying to figure out dll build.
Okay, committed. Jonathan

Gennadiy Rozental wrote:
Do you have any idea why Borland fail to find rand()?
Yes. For some reason I couldn't figure it out before. The implementation of random shuffle makes an unqualified call to rand, but rand is actually in namespace std. The iostream tests compile correctly if I add the following to unit_test_suite.ipp, after the final include directive: #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ BOOST_WORKAROUND(_STLPORT_VERSION, <= 0x450) \ /**/ using std::rand; #endif Should I commit? Jonathan

"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message news:cvno4v$ibi$1@sea.gmane.org...
Gennadiy Rozental wrote:
Do you have any idea why Borland fail to find rand()?
Yes. For some reason I couldn't figure it out before. The implementation of random shuffle makes an unqualified call to rand, but rand is actually in
Doesn't random shuffle is also in namespace std? Why would it fail to resolve symbol from the same namespace?
namespace std. The iostream tests compile correctly if I add the following to unit_test_suite.ipp, after the final include directive: #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ BOOST_WORKAROUND(_STLPORT_VERSION, <= 0x450) \ /**/ using std::rand; #endif
Does above mean that the same isuue is with STLPort before version 4.5.0?
Should I commit?
Ok.
Jonathan
Gennadiy.

Gennadiy Rozental wrote:
"Jonathan Turkanis" :
Gennadiy Rozental wrote:
Do you have any idea why Borland fail to find rand()?
Yes. For some reason I couldn't figure it out before. The implementation of random shuffle makes an unqualified call to rand, but rand is actually in
Doesn't random shuffle is also in namespace std? Why would it fail to resolve symbol from the same namespace?
Good point. I did some poking around, and what seems to be happening is that random_shuffle is defined in namespace _STL but is brought into namespace std by a using directive: namespace std { using namespace _STLPORT_STD } where _STLPORT_STD is #define'd as _STL. I might be wrong, becasue I'm unfamiliar with the structure of the STLPort source, but it looks like this is what is happening. It thefore looks like the problem is an incompatibility between STLPort 4.5 and the Borland C runtime library.
namespace std. The iostream tests compile correctly if I add the following to unit_test_suite.ipp, after the final include directive: #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ BOOST_WORKAROUND(_STLPORT_VERSION, <= 0x450) \ /**/ using std::rand; #endif
Does above mean that the same isuue is with STLPort before version 4.5.0?
I'm not sure, but I don't know the exact versions of STLPort which have shipped with Borland 5.x.
Should I commit?
Ok.
All right, done.
Jonathan
participants (2)
-
Gennadiy Rozental
-
Jonathan Turkanis