Error C2451: Illegal conditional expression of type 'UnaryOp<E1, Op>' in ostream - visual studio 9

Posted by Steven Hill on Stack Overflow See other posts from Stack Overflow or by Steven Hill
Published on 2010-03-19T02:01:58Z Indexed on 2010/03/19 2:11 UTC
Read the original article Hit count: 486

I am getting a repeated error with VS 9. The code compiles under GNU C++, but I want debug with the VS IDE. Any idea what could be causing this error.

Error 13 error C2451: conditional expression of type 'UnaryOp' is illegal \Microsoft Visual Studio 9.0\VC\include\ostream 512

//unary constraint template class UnaryOp : public Constraint { public: const E1& e1; UnaryOp(const E1& _e1); bool Satisfiable() const; Bool SatisfiableAux() const; void Print (std::ostream& os) const; UnaryOp* clone () const; //operator bool () const { return true; } }; template std::ostream& operator<<(std::ostream& os, const UnaryOp& unop);

UnaryOp code that uses ostream: template INLINE void UnaryOp::Print (std::ostream& os) const { os << *this; }

template INLINE std::ostream& operator<<(std::ostream& os, const UnaryOp& unop) { return os << Op::name << unop.e1; }

ostream line with error:

_Myt& __CLR_OR_THIS_CALL put(_Elem _Ch)
    {   // insert a character
    ios_base::iostate _State = ios_base::goodbit;
    const sentry _Ok(*this);

512>> if (!_Ok) _State |= ios_base::badbit; else { // state okay, insert character _TRY_IO_BEGIN

© Stack Overflow or respective owner

Related posts about visual-studio-2008-sp1

Related posts about vc++