[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.

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). Stephan T. Lavavej Visual C++ Libraries Developer -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Edward Diener Sent: Wednesday, May 11, 2011 7:07 PM To: boost@lists.boost.org 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

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@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Edward Diener Sent: Wednesday, May 11, 2011 7:07 PM To: boost@lists.boost.org 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

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, May 11, 2011, Edward Diener wrote:
The class in question is evidently "boost::signals2::detail::signal3_impl<R,T1,T2,T3,Combiner,Group,GroupCom pare,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.
Does the attached patch which declares the assignment operator private suppress the warnings? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk3L33AACgkQ5vihyNWuA4ViSgCePepWNPEUIHuFcek3afnSt6yh wLsAniAqkwN81bqciVHVdfI3ikRLtjQR =G0CI -----END PGP SIGNATURE-----

On 5/12/2011 9:23 AM, Frank Mori Hess wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wednesday, May 11, 2011, Edward Diener wrote:
The class in question is evidently "boost::signals2::detail::signal3_impl<R,T1,T2,T3,Combiner,Group,GroupCom pare,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.
Does the attached patch which declares the assignment operator private suppress the warnings?
Yes it suppresses the warnings for VC++. Good patch. Can you add that to the trunk ?
participants (3)
-
Edward Diener
-
Frank Mori Hess
-
Stephan T. Lavavej