[cfe-dev] [libc++] possible bug?

Ovanes Markaryan om_clang at keywallet.com
Sun Apr 22 14:58:24 PDT 2012

On Sun, Apr 22, 2012 at 11:32 PM, Marc Glisse <marc.glisse at inria.fr> wrote:

> On Sun, 22 Apr 2012, Ovanes Markaryan wrote:
>  Hello *,
>> just tried to compile SYMPHONY-5.4.4 with clang 3.0 + libc++ (tag 31).
>> While
>> compiling it I receive this error:
>> include/c++/v1/algorithm:643:**97: error: invalid operands to binary
>> expression
>>       ('const reducedCost' and 'const reducedCost')
>>     _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1&
>> __y) const {return __x < __y;}
> [...]
>      bool operator<(const reducedCost & other)
> Missing const here. It is often preferable to avoid making operators
> member functions when you can avoid it.
>      {
>>         return (value>other.value);
>>     }
> --
> Marc Glisse

Hello Marc,

you are definitely right. I overlooked it, since as already wrote this is
not my code (just copy pasted it from the lib)... But in my tests I
commented out this operator< and provided the specialization of  std::less,
to just test it and it failed as well. I did not test with both enable
(operator< and less-specialization). Actually this code is somehow really
bad, because less is actually not less but greater ;) This code compiles
fine with gcc and clang + gcc's version of stdlib. As far as I remember the
standard requires that std::less is specialized to allow the less
comparison or the operator< is implicitly used through the generalized
less. In my tests less specialization was not considered by make_heap. This
is my point.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120422/966bf958/attachment.html>

More information about the cfe-dev mailing list