<div class="gmail_extra"><br><br><div class="gmail_quote">Le 22 avril 2012 23:58, Ovanes Markaryan <span dir="ltr"><<a href="mailto:om_clang@keywallet.com" target="_blank">om_clang@keywallet.com</a>></span> a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><div class="gmail_quote"><div class="im">On Sun, Apr 22, 2012 at 11:32 PM, Marc Glisse <span dir="ltr"><<a href="mailto:marc.glisse@inria.fr" target="_blank">marc.glisse@inria.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Sun, 22 Apr 2012, Ovanes Markaryan wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello *,<br>
just tried to compile SYMPHONY-5.4.4 with clang 3.0 + libc++ (tag 31). While<br>
compiling it I receive this error:<br>
<br>
include/c++/v1/algorithm:643:<u></u>97: error: invalid operands to binary<br>
expression<br>
      ('const reducedCost' and 'const reducedCost')<br>
    _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1&<br>
__y) const {return __x < __y;}<br>
</blockquote>
<br></div>
[...]<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    bool operator<(const reducedCost & other)<br>
</blockquote>
<br></div>
Missing const here. It is often preferable to avoid making operators member functions when you can avoid it.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    {<br>
        return (value>other.value);<br>
    }<span><font color="#888888"><br>
</font></span></blockquote><span><font color="#888888">
<br>
-- <br>
Marc Glisse<br></font></span></blockquote><div><br></div></div><div>Hello Marc,</div><div><br></div><div>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.</div>


<div><br></div><div>Thanks,</div><div>Ovanes</div><div><br></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br>Two questions:<br><br>1. Does it work if you actually specify that `operator<` is `const` ?<br><br>2. Did you were careful about putting the specialization of `less` (for this class) before its first use ? (it is not clear from your example)<br>
<br>If you could, for example, provide a simple attachment that reproduces the issue it would be slightly simpler to investigate.<br><br>-- Matthieu<br></div>