|
Boost : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-10-15 13:05:59
The aforementioned rev includes the following new member function:
test_unit_id
test_suite::get( const_string tu_name ) const
{
BOOST_TEST_FOREACH( test_unit_id, id, m_members ) {
if( const_string(framework::get( id, test_id_2_unit_type( id ) ).p_name) == tu_name )
return id;
}
return INV_TEST_UNIT_ID;
}
which unfortunately results in the following code:
#include <boost/test/included/test_exec_monitor.hpp>
int test_main(int,char *[])
{
return 0;
}
failing in MSVC++ 6.0 (and possibly also 7.0) with:
...\boost\test\impl\unit_test_suite.ipp(158) : error C2676: binary '==' :
'class boost::unit_test::readwrite_property<class std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> > >' does not define this operator or a conversion to a type acceptable
to the predefined operator
Looks like the compiler is having a hard time with ADLing the appropriate
overload of operator== in this particular dependent context. By changing the
offending line like this, however,
if( const_string( framework::get( id, test_id_2_unit_type( id ) ).p_name ) == tu_name )
everything works fine (checked in MSVC++ 6.0 and GCC 3.2). As this is a
rather innocent change and definitely helps poor old MSVC++ 6.0, is it OK to
commit the attached patch?
Thank you,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Index: unit_test_suite.ipp
===================================================================
--- unit_test_suite.ipp (revision 40053)
+++ unit_test_suite.ipp (working copy)
@@ -155,7 +155,7 @@
test_suite::get( const_string tu_name ) const
{
BOOST_TEST_FOREACH( test_unit_id, id, m_members ) {
- if( framework::get( id, test_id_2_unit_type( id ) ).p_name == tu_name )
+ if( const_string( framework::get( id, test_id_2_unit_type( id ) ).p_name ) == tu_name )
return id;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk