#125: Ambiguity in comparaison with literals
--------------------------------+-------------------------------------------
Reporter: garrigues | Owner: theo
Type: defect | Status: new
Priority: major | Milestone: Olena 1.0ß
Component: Milena | Version: 1.0
Keywords: literals operators |
--------------------------------+-------------------------------------------
This test shows the problem :
{{{
#!cpp
# include <mln/value/gl8.hh>
# include <mln/literal/all.hh>
int main()
{
using mln::value::gl8;
using mln::literal::white;
gl8 b;
b == white;
}
}}}
The compiler can't find the right operator== to compate graylevel with
literals.
Here is the error output :
{{{
test.cc: In function 'int main()':
test.cc:11: error: ISO C++ says that these are ambiguous, even though the
worst conversion for the first is better than the worst conversion for the
second:
../../mln/literal/ops.hh:252: note: candidate 1: typename
mln::trait::op::eq<O, O>::ret mln::operator==(const mln::Object<E>&,
const
mln::Literal<L>&) [with O = mln::value::graylevel<8u>, L =
mln::literal::white_t]
../../mln/value/internal/gray_f.hh:317: note: candidate 2: bool
mln::value::operator==(const mln::value::Integer<I>&, const
mln::value::graylevel_f&) [with I = mln::value::graylevel<8u>]
}}}
--
Ticket URL: <https://trac.lrde.epita.fr/olena/ticket/125>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image library.