On 20/06/11 20:03, Matthias Melcher wrote: > On 20.06.2011, at 11:39, MacArthur, Ian (SELEX GALILEO, UK) wrote: > >> Just refreshed my fltk3 snapshot - fails with the following errors. >> (NOTE: I don't think I've ever seen one of those errors before, now we >> have several!) >> >> >> Compiling Fl_File_Chooser2.cxx... >> Fl_File_Chooser2.cxx: In member function `void >> fltk3::FileChooser::fileNameCB()': >> Fl_File_Chooser2.cxx:870: 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: >> ../fltk3/ask.h:61: note: candidate 1: void fltk3::alert(char*, const >> char*) >> ../fltk3/ask.h:60: note: candidate 2: void fltk3::alert(const char*, >> ...) > Wow, no, I have never seen those before either. I am using va_list as an > argument. Maybe that's what's causing it. I will look into this later. > If I remember this error right it's caused by the compiler attempting to "guess" at a conversion from one type to the other. What you're passing to alert() at this point in the code is a const char* and then another const char*. The compiler sees the first version of alert and sees that the worst conversion is 1 simple standard-defined cast from const char* to char*, so this function is a viable candidate to be called. However, in the case of the second, the worst conversion is converting to the va_list, which is slightly more than 1 simple standard-defined cast. However, the biggest problem for the first definition is converting the first parameter and the biggest problem for the second definition is converting the second parameter - so both fail equally. To the compiler, these are both equally bad and as such it doesn't know which it should pick, which is technically correct standard behaviour (13.3.3)
What I'd suggest doing is simply explicitly casting the first parameter to a char*; this _should_ fix your issue (at least it doesn't create any on gcc under Ubuntu 10.10). I suspect the only person who could confirm such a fix would be Ian, though.... Ben _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
