Boost logo

Boost :

Subject: Re: [boost] [signals2] trunk - vc++ 10 warning about assignment operator
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2011-05-11 22:20:20


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_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


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