|
Boost : |
From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-08-13 16:08:41
Well, I dig it up...
It's due to a problem with bcc5.5.1, which boils down to this:
struct X
{
typedef long (X::*bool_type)() const;
operator bool_type() const { return 0 ; }
} ;
void foo(bool x);
void foo(int);
int main()
{
X x ;
foo( x ); // Cannot find a match for 'foo<X>'
return 0 ;
}
The new Test library contains various overloads of the function:
test_and_continue_impl
The reason why the previous Test library worked is that the old BOOST_TEST()
uses operator ?, while the new macro calls that overloaded function,
triggering the ambiguity.
I think that the best patch would be to change the macros of this form:
#define BOOST_CHECK(predicate) \
boost::test_toolbox::detail::test_and_continue_impl((predicate), \
boost::test_toolbox::detail::wrapstrstream() << #predicate,
__FILE__, __LINE__)
to this:
#define BOOST_CHECK(predicate) \
boost::test_toolbox::detail::test_and_continue_impl(!!(predicate), \
boost::test_toolbox::detail::wrapstrstream() << #predicate,
__FILE__, __LINE__)
That is: use '!!' instead of the implicit bool conversion. (which btw is
what I alway do...)
Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk