Manuel Teira Paz wrote:

"qpid/client/SessionImpl.cpp", line 747: Error: Ambiguous "?:" expression, second operand of type "qpid::ClosedException*" and third operand of type "qpid::sys::ExceptionHolder" can be converted to one another. "qpid/client/SessionImpl.cpp", line 747: Error: Formal argument ex of type const qpid::sys::ExceptionHolder& in call to qpid::client::Demux::close(const qpid::sys::ExceptionHolder&) is being passed int.
2 Error(s) and 8 Warning(s) detected.


The 747th line stands:

demux.close(exceptionHolder.empty() ? new ClosedException() : exceptionHolder);


As a potential hint for somebody more experimented, this code compiles, and however is functionally similar to the one throwing the error:

struct A {};
struct B {
  B();
  template <class Ex> B(Ex *e);
};
void call(const B &b);
void foo(bool i)
{
  B b;
  call(i ? new A() : b);
}

Well, even when I'm not sure about the reason for sys::ExceptionHolder being convertible to ClosedException, it seems that the poor Sun compiler trusts it's able to do it. I've fixed the issue adding an explicit ExceptionHolder constructor to resolve the ambiguity, finishing with something like:

demux.close(exceptionHolder.empty() ? sys::ExceptionHolder(new ClosedException()) : exceptionHolder);


Do you agree with this fix?


Yes, that's a good fix. I think the sun compiler is mistaken about the conversion but the fix will work for any compiler.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to