Boost logo

Boost :

Subject: Re: [boost] [signals2] trunk - vc++ 10 warning about assignment operator
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-05-11 22:52:49


On 5/11/2011 10:20 PM, Stephan T. Lavavej wrote:
> That's a warning, not an error, and it's emitted when a class has a reference data member or a const data member, which inhibits the implicit definition of a copy assignment operator:
>
> C:\Temp>type hiss.cpp
> struct Foo {
> explicit Foo(int& i) : r(i) { }
>
> int& r;
> };
>
> struct Bar {
> explicit Bar(int i) : c(i) { }
>
> const int c;
> };
>
> C:\Temp>cl /EHsc /nologo /W4 /c hiss.cpp
> hiss.cpp
> hiss.cpp(5) : warning C4512: 'Foo' : assignment operator could not be generated
> hiss.cpp(1) : see declaration of 'Foo'
> hiss.cpp(11) : warning C4512: 'Bar' : assignment operator could not be generated
> hiss.cpp(7) : see declaration of 'Bar'
>
> Assuming that the reference/const data member is intentional, this warning is pure noise and should be suppressed by push/disable/pop (i.e. in Boost's headers).

OK, your explanation is understood.

The class in question is evidently
"boost::signals2::detail::signal3_impl<R,T1,T2,T3,Combiner,Group,GroupCompare,SlotFunction,ExtendedSlotFunction,Mutex>::slot_invoker",
so I guess I am saying that this vc++ warning should be suppressed
there. My own template, given in my OP, is not the culprit.

In effect not suppressing the warning at the signal2 level means that
any code which instantiates a boost::signals2::signal object is going to
get the warning, and has to suppress in each spot, whereas if signals2
suppressed the warning, user's of that library would not have to bother
to do so themselves.

Normally I would not be for suppressing warnings unless the warning is
knowm to be innocuous.

>
> Stephan T. Lavavej
> Visual C++ Libraries Developer
>
> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Edward Diener
> Sent: Wednesday, May 11, 2011 7:07 PM
> To: boost_at_[hidden]
> Subject: [boost] [signals2] trunk - vc++ 10 warning about assignment operator
>
> An attempt to instantiate a signals2 signal of the form:
>
> template<class T> class notification_boost_signal2
> {
>
> public:
>
> boost::signals2::signal<void (const i_some_interface<T>
> &,boost::optional<T>,T)> sig;
>
> };
>
> for notification_boost_signal2<char>, gives the error message in vc++ of:
>
> "C:\Programming\VersionControl\boost\boost/signals2/detail/signal_template.hpp(367)
> : warning C4512:
> 'boost::signals2::detail::signal3_impl<R,T1,T2,T3,Combiner,Group,GroupCompare,SlotFunction,ExtendedSlotFunction,Mutex>::slot_invoker'
> : assignment operator could not be generated"
>
> There is a huge template trace leading up to this final warning, but
> before giving it I wonder if anyone knows what it is about ? Perhaps
> Frank Mori Hess or Douglas Gregor is out there and can tell me what is
> happening.
>
> _______________________________________________
> Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
> _______________________________________________
> Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk