[csw-maintainers] Error: Ambiguous "?:" expression

Roger Håkansson hson at opencsw.org
Tue Mar 9 03:12:30 CET 2010


On 2010-03-09 00:40, Jake Goerzen wrote:
> "marked-up_text.cpp", line 222: Error: Ambiguous "?:" expression,
> second operand of type "surface" and third operand of type "int" can
> be converted to one another.
>
> the relevant part of marked-up_text.cpp (line 222) contains:
>
>          return draw_text(gui != NULL ? gui->getSurface() : NULL, area,
> size, colour, txt, x, y, use_tooltips, style);
>
>
> Is there some syntax I can add/modify to this statement that will
> clear up the ambiguity the compiler is complaining about?
>

My interpretation is that the problem is that the surface class have 
operators both for converting a surface object to an int as well as 
converting a int to a surface object and that code is not clear on 
what's the desired way.

I had a quick look at the code in your homedir and draw_text is defined 
in font.cpp and takes a surface object as first parameter so you 
probably want to change that line to:

return draw_text((gui != NULL ? gui->getSurface() : (surface)NULL), 
area, size, colour, txt, x, y, use_tooltips, style);



More information about the maintainers mailing list