|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-20 19:44:42
Peter Dimov wrote:
> Jared McIntyre wrote:
>> I just started testing the boost 1.34 (RC_1_34_0) cvs branch in our
>> main code line. We're getting a lot of warnings with bind. I'm using
>> Visual Studio 8 SP1. This is a test case that reproduces the warning:
>>
>> #include <boost/bind.hpp>
>> #include <string>
>>
>> class WarningTest
>> {
>> public:
>> WarningTest(void)
>> {
>> boost::bind(&WarningTest::Function, this);
>> }
>>
>> std::string Function()
>> {
>> }
>> };
>
> Seems like an annoying compiler bug, not present in 7.1. [...] Pity that
> nobody caught that earlier.
One reason that nobody caught it is that it fails only with class/struct
return types. Compilers are a lot of fun.
Not.
Here's a minimal example that demonstrates the issue, if someone would like
to take this to MS. As a regression against 7.1, it might receive a
priority:
template< class Pm > struct add_cref;
template< class R, class T > struct add_cref< R (T::*) () >
{
typedef void type;
};
template< class M, class T > typename add_cref< M T::* >::type f( M T::* )
{
}
struct X
{
};
struct Z
{
int f1()
{
return 0;
}
X f2()
{
return X();
}
};
int main()
{
f( &Z::f1 ); // OK
f( &Z::f2 ); // fails!
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk