Boost logo

Boost Users :

From: Meißner, Joachim (meissner_at_[hidden])
Date: 2004-12-20 10:30:35


Hi

Environment:
MS 7.1 compile with MS implementation of STL
Boost 1.32.0

Summary:

I get an internal compiler error using boost::variant as a parameter of a
boost::signal compiling with MSDEV 7.1, but not with gcc3.3/3.4 or MinGW (3.5).

Does anyone knows a workaround other than not using boost::signals?

Details

Using a signal with a variant of 2 simple classes (see code snippet) leads to an
internal compiler error C1001. Using pragma command to turn optimisation off as
Suggested by the compiler does not change a thing

Does anyone knows a workaround?

Regards, jom

Here's the bad code snippet:

#include <boost/bind.hpp>
#include <boost/signals.hpp>
#include <boost/variant.hpp>

#include <vector>

class MessageException : public std::exception
{
public:
    MessageException()
        : std::exception( "Message error" )
    {}
};

class Message
{
public:
    typedef std::vector<unsigned char> Content;

    Message(unsigned int p, unsigned char def = ' ')
        : m_vector( p, def )
    {}

    const Content& message() {return m_vector;}
private:
    Content m_vector;
};

typedef boost::variant<MessageException, Message> MessageVariant;

class TestWrap
{
public:
    TestWrap(){}

    typedef boost::signal1<void, MessageVariant> MessageSignal;
    //typedef boost::signal<void (MessageVariant)> MessageSignal;

    void send_signal (MessageVariant& variant)
    {
        m_message_signal( variant );
    }
private:
    MessageSignal m_message_signal;
};


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net