Manuel Teira Paz escribió:
Manuel Teira Paz escribió:
Hello.
During the compilation of the c++ client, I've hit an error I'm not able
to figure out what could be the cause:
CC -g -m64 -DHAVE_CONFIG_H -I. -Igen -I./gen
-DMODULE_DIR=\"/opt/qpid/lib/qpid/client\"
-DCONF_FILE=\"/opt/qpid/etc/qpid/qpidc.conf\" -I/opt/qpid/include
-library=stlport4 -mt -c qpid/client/SessionImpl.cpp -KPIC -DPIC -o
qpid/client/.libs/libqpidclient_la-SessionImpl.o
"qpid/client/SessionImpl.cpp", line 162: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 168: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 176: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 195: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 233: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 304: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 337: Warning: id hides
qpid::client::SessionImpl::id.
"qpid/client/SessionImpl.cpp", line 546: Warning: id hides
qpid::client::SessionImpl::id.
"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?
Regards.
If I'm not misunderstood, it complains about new ClosedException() and
exceptionHolder being equivalent or something so?
Any hint from the experienced C++ force ?
Regards.
--
Manuel.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]