Hello *,<div><br></div><div>just tried to compile SYMPHONY-5.4.4 with clang 3.0 + libc++ (tag 31). While compiling it I receive this error:</div><div><br></div><div><div>include/c++/v1/algorithm:643:97: error: invalid operands to binary expression</div>
<div> ('const reducedCost' and 'const reducedCost')</div><div> _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}</div><div> ~~~ ^ ~~~</div>
<div>/home/ovanes/toolsets/clang-3.0/include/c++/v1/algorithm:4433:13: note: in instantiation of member function 'std::__1::__less<reducedCost,</div><div> reducedCost>::operator()' requested here</div>
<div>
if (__comp(*__ptr, *--__last))</div><div> ^</div><div>/home/ovanes/toolsets/clang-3.0/include/c++/v1/algorithm:4524:13: note: in instantiation of function template specialization</div><div> 'std::__1::__push_heap_back<std::__1::__less<reducedCost, reducedCost> &, reducedCost *>' requested here</div>
<div> __push_heap_back<_Compare>(__first, ++__last, __comp, ++__i);</div><div> ^</div><div>/home/ovanes/toolsets/clang-3.0/include/c++/v1/algorithm:4539:5: note: in instantiation of function template specialization</div>
<div> 'std::__1::__make_heap<std::__1::__less<reducedCost, reducedCost> &, reducedCost *>' requested here</div><div> __make_heap<_Comp_ref>(__first, __last, __comp);</div><div> ^</div>
<div>/home/ovanes/toolsets/clang-3.0/include/c++/v1/algorithm:4548:5: note: in instantiation of function template specialization</div><div> 'std::__1::make_heap<reducedCost *, std::__1::__less<reducedCost, reducedCost> >' requested here</div>
<div> _VSTD::make_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());</div><div> ^</div><div>/home/ovanes/toolsets/clang-3.0/include/c++/v1/__config:174:15: note: expanded from:</div>
<div>#define _VSTD std::_LIBCPP_NAMESPACE</div></div><div><br></div><div><br></div><div>I stripped down a code example which reproduces the error. This is not my code, this the code from the lib (please don't judge me when looking to it ;)</div>
<div><br></div><div><div>struct reducedCost</div><div>{</div><div> /** To avoid computing two times the same row direction will have strange</div><div> values, direction is -1 or 1 if for only one of the two direction</div>
<div> rc is <0 and is -2 or 2 if the two direction have one <0 rc with the sign</div><div> indicating which one of the two directions is the best.<br></div><div> Note that by theory only one reduced cost (for u_i, or v_i)</div>
<div> maybe negative for each direction.</div><div> */</div><div> int direction;</div><div> /** gammSign is the sign of gamma (corresponding to taking rc for u_i or v_i)</div><div> for the best of the two rc for this row.*/</div>
<div> int gammaSign;</div><div> /** gammaSign2 is the sign of gamma for the worst of the two rc for this row.*/</div><div> int gammaSign2;</div><div> /** if both reduced costs are <0 value is the smallest of the two.*/</div>
<div> double value;</div><div> /** greatest of the two reduced costs */</div><div> double value2;</div><div> /** index of the row.*/</div><div> int row;</div><div> bool operator<(const reducedCost & other)</div>
<div> {</div><div> return (value>other.value);</div><div> }</div><div>};</div><div><br></div><div>int main()</div><div>{</div><div> reducedCost r[100]={};</div><div><br></div><div> std::make_heap(&r[0], &r[0]+100);</div>
<div> return 0;</div><div>};</div></div><div><br></div><div><br></div><div>I think the problem results because std::less is not defined directly in std namespace, but in std::__1 and was not properly introduced into the std-Namespace? Because specializing std::less<reduceCost> still produces the same error:</div>
<div><br></div><div><div>namespace std</div><div>{</div><div> template<></div><div> struct less<reducedCost></div><div> : ::std::binary_function<reducedCost, reducedCost, bool></div><div> {</div>
<div> bool operator()(const reducedCost & lhs, const reducedCost & rhs)const</div><div> {</div><div> return lhs.value>rhs.value;</div><div> }</div><div> };</div><div>}</div><div>
<br></div><div>But, if explicitly specializing std::less<reducedCost> as comparison functor fixes the problem.</div><div><br></div><div>std::make_heap(&r[0], &r[0]+100, std::less<reducedCost>());</div>
<div><br></div><div>Thanks,</div><div>Ovanes</div><div><br></div><div><br></div></div><div><br></div>