
Hi, I just started testing Boost 1.34.1 and have found this piece of code produces a warning, which was not present in Boost 1.33.1: --- #include <boost/bind.hpp> struct Foo {}; struct Bar { Foo GetFoo() { return Foo(); } }; int main() { Bar bar; boost::bind(&Bar::GetFoo, bar); } --- 1>boost\boost.1.34.1\boost\boost\bind.hpp(1575) : warning C4180: qualifier applied to function type has no meaning; ignored 1> boost\boost.1.34.1\boost\boost\bind.hpp(1609) : see reference to class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled 1> with 1> [ 1> Pm=Foo (__thiscall Bar::* )(void), 1> I=1 1> ] 1> test1\test1.cpp(16) : see reference to class template instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled 1> with 1> [ 1> Pm=Foo (__thiscall Bar::* )(void), 1> A1=Bar 1> ] It seems to pick this specialisation: template< class M, class T > struct add_cref< M T::*, 1 > { typedef M const & type; //bind.hpp(1575) }; When I would have thought this one more appropriate: template< class R, class T > struct add_cref< R (T::*) (), 1 > { typedef void type; // bind.hpp(1580) }; Any ideas? Thanks, Ben

Ben Pope:
Hi,
I just started testing Boost 1.34.1 and have found this piece of code produces a warning, which was not present in Boost 1.33.1:
...
It seems to pick this specialisation: template< class M, class T > struct add_cref< M T::*, 1 > { typedef M const & type; //bind.hpp(1575) };
When I would have thought this one more appropriate:
template< class R, class T > struct add_cref< R (T::*) (), 1 > { typedef void type; // bind.hpp(1580) };
Any ideas?
None. We've reported this to Microsoft and they have (after much deliberation) classified it as a bug, but apparently a fix would be non-trivial and I don't know whether they plan to ever issue one for the MSVC 8 line. The warning is harmless, as the wrong specialization is only used in a return type in an overload that isn't chosen (the only purpose of this specific specialization is to avoid the warning).

On 18/10/2007, Peter Dimov wrote:
Ben Pope:
Hi,
I just started testing Boost 1.34.1 and have found this piece of code produces a warning, which was not present in Boost 1.33.1:
...
It seems to pick this specialisation: template< class M, class T > struct add_cref< M T::*, 1 > { typedef M const & type; //bind.hpp(1575) };
When I would have thought this one more appropriate:
template< class R, class T > struct add_cref< R (T::*) (), 1 > { typedef void type; // bind.hpp(1580) };
Any ideas?
None. We've reported this to Microsoft and they have (after much deliberation) classified it as a bug, but apparently a fix would be non-trivial and I don't know whether they plan to ever issue one for the MSVC 8 line.
The warning is harmless, as the wrong specialization is only used in a return type in an overload that isn't chosen (the only purpose of this specific specialization is to avoid the warning).
OK, thanks. Ben

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Peter Dimov Sent: 18 October 2007 17:41 To: boost@lists.boost.org Subject: Re: [boost] Bind and MSVC 8 SP1
Ben Pope:
Hi,
I just started testing Boost 1.34.1 and have found this piece of code produces a warning, which was not present in Boost 1.33.1:
...
It seems to pick this specialisation: template< class M, class T > struct add_cref< M T::*, 1 > { typedef M const & type; //bind.hpp(1575) };
When I would have thought this one more appropriate:
template< class R, class T > struct add_cref< R (T::*) (), 1 > { typedef void type; // bind.hpp(1580) };
Any ideas?
None. We've reported this to Microsoft and they have (after much deliberation) classified it as a bug, but apparently a fix would be non-trivial and I don't know whether they plan to ever issue one for the MSVC 8 line.
The warning is harmless, as the wrong specialization is only used in a return type in an overload that isn't chosen (the only purpose of this specific specialization is to avoid the warning).
Can I take it that the warnings I moaned about in Trac #1097: keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored is the same problem, and can be safely suppressed? (And if do should someone close the Trac item?) Thanks Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com

Paul A Bristow:
Can I take it that the warnings I moaned about in Trac #1097:
keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored
is the same problem, and
can be safely suppressed?
Doesn't look the same problem to me, but I could be wrong. How about posting a program that generates the warning? The ticket doesn't contain enough information.

Regarding the op, this sounds like a bug Jared McIntyre told me about at BoostCon. He said that there was a case he found in some of his existing code in which the wrong overload was being picked (and a warning indicating this issued), in the VC8 SP1 version of the compiler, but not the VC8 pre-SP1 version. This was not a harmless ignorable warning, but actually caused errors. He reported the bug, and was told it would not be fixed as of VC9, but maybe after that. I don't know any more details, so you may want to email him about it. Zach Laine On 10/19/07, Peter Dimov <pdimov@pdimov.com> wrote:
Paul A Bristow:
Can I take it that the warnings I moaned about in Trac #1097:
keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored
is the same problem, and
can be safely suppressed?
Doesn't look the same problem to me, but I could be wrong. How about posting a program that generates the warning? The ticket doesn't contain enough information.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Peter Dimov Sent: 19 October 2007 12:05 To: boost@lists.boost.org Subject: Re: [boost] Bind and MSVC 8 SP1
Paul A Bristow:
Can I take it that the warnings I moaned about in Trac #1097:
keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored
is the same problem, and
can be safely suppressed?
Doesn't look the same problem to me, but I could be wrong. How about posting a program that generates the warning? The ticket doesn't contain enough information.
Thanks for this feedback. But sadly I am no longer am working on the code that produced it because we have also found that Boost.Parameter is less convenient to use (for many things to set), compared to using chained function calls my_plot.title("My_title).x_axis(red).y_axis(blue). .... and Boost.Parameter causes an annoying increase in compile time too. Perhaps other users of Boost.parameter and keyword.hpp have/will encountered it? Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com
participants (4)
-
Ben Pope
-
Paul A Bristow
-
Peter Dimov
-
Zach Laine