qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: qpid (cpp) on solaris + Sun Studio 12
Date Mon, 26 May 2008 20:53:15 GMT
Manuel Teira wrote:
> Manuel Teira escribió:
>>
>> Unfortunately, I've found a problem I'm not able to solve by myself,
>> while compiling src/qpid/SessionState.cpp:
>>
>> source='qpid/SessionState.cpp' object='qpid/SessionState.lo' 
>> libtool=yes \
>> DEPDIR=.deps depmode=none /bin/bash ../build-aux/depcomp \
>> /bin/bash ../libtool --tag=CXX    --mode=compile CC -m64 -mt
>> -library=stlport4 -DHAVE_CONFIG_H -I. -Igen -I./gen
>> -I/opt/dslap/contrib/include -c -o qpid/SessionState.lo
>> qpid/SessionState.cpp
>> mkdir qpid/.libs
>>  CC -m64 -mt -library=stlport4 -DHAVE_CONFIG_H -I. -Igen -I./gen
>> -I/opt/dslap/contrib/include -c qpid/SessionState.cpp  -KPIC -DPIC -o
>> qpid/.libs/SessionState.o
>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algobase.c", line 375:
>> Error: Cannot use qpid::Range<qpid::framing::SequenceNumber> to
>> initialize const qpid::framing::SequenceNumber.
>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
>> Where: While instantiating
>> "std::__lower_bound<qpid::Range<qpid::framing::SequenceNumber>*,
>> qpid::framing::SequenceNumber, std::less<qpid::framing::SequenceNumber>,
>> long>(qpid::Range<qpid::framing::SequenceNumber>*,
>> qpid::Range<qpid::framing::SequenceNumber>*, const
>> qpid::framing::SequenceNumber&,
>> std::less<qpid::framing::SequenceNumber>, long*)".
>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
>> Where: Instantiated from
>> qpid::RangeSet<qpid::framing::SequenceNumber>::addRange(const
>> qpid::Range<qpid::framing::SequenceNumber>&).
>> "./qpid/RangeSet.h", line 152:     Where: Instantiated from non-template
>> code.
>> 1 Error(s) detected.
>> *** Error code 1
>>
>> It seems that the error is triggered by some usage of the     RangeSet&
>> operator+=(const Range& r) , perhaps just a constantness issue, but I'm
>> not able to find exactly where the problem is.
>>   
> Some more info about this error. The instantiated template is:
> 
> 
> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
> Information: Instantiating
>  std::__lower_bound<qpid::Range<qpid::framing::SequenceNumber>*,
>                                   qpid::framing::SequenceNumber,
>                                   std::less<qpid::framing::SequenceNumber>,
>                                   long>
> (qpid::Range<qpid::framing::SequenceNumber>*,
> qpid::Range<qpid::framing::SequenceNumber>*,
> const qpid::framing::SequenceNumber&,
> std::less<qpid::framing::SequenceNumber>,
> long*).
> 
> The involved code in the Sun STL headers is:
> 
> template <class _ForwardIter, class _Tp>
> inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
>                                   const _Tp& __val) {
>  _STLP_DEBUG_CHECK(__check_range(__first, __last))
>  return __lower_bound(__first, __last, __val, less<_Tp>(), 
> _STLP_DISTANCE_TYPE(__first, _ForwardIter)); //This line
> }
> 
> That calls:
> 
> template <class _ForwardIter, class _Tp, class _Compare, class _Distance>
> _ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
>                           const _Tp& __val, _Compare __comp, _Distance*)
> {
>  _Distance __len = distance(__first, __last);
>  _Distance __half;
>  _ForwardIter __middle;
> 
>  while (__len > 0) {
>    __half = __len >> 1;
>    __middle = __first;
>    advance(__middle, __half);
>    if (__comp(*__middle, __val)) {         //This line
>      __first = __middle;
>      ++__first;
>      __len = __len - __half - 1;
>    }
>    else
>      __len = __half;
>  }
>  return __first;
> }
> 
> 
> It seems that the code line triggering the whole problem is, in 
> src/qpid/RangeSet.h (line 224):
> 
>    typename Ranges::iterator i =
>        std::lower_bound(ranges.begin(), ranges.end(), r.begin());
> 
> 
> I'm not able to see anything wrong in all that. Any idea or test case to 
> help finding any hint about this?
> 

I don't see anything wrong either but try updating to revision 660302 or later.

I removed the RangeSet::Range typedef and replaced it with Range<T>. Don't ask 
me why, it's just a wild stab in the dark based on vague intuition. I've really 
no idea why Sun C++ is objecting here.

I've got no systematic suggestions for handling these type of template issues, 
my approach is to repeatedly bang my head on the problem until it's fixed or I 
pass out, whichever comes first.

Mime
View raw message