I think it has something to do with hiding the function(s) in the base classes, and the GCC's error message doesn't seem to help much, even if you use struct
instead of enum
: In fact, the error message is misleading, because now Ea
and Eb
are two different classes, with no implicit conversion from Ea
to Eb
, the ambiguity shouldn't arise, but GCC seems to disagree with me : http://ideone.com/cvzLW (see the modification also).
Anyway, if you bring the functions in the class scope, explicitly by writing using
as:
struct Sbroken : Sa, Sb
{
using Sa::operator();
using Sb::operator();
};
then it works : http://ideone.com/LBZgC
Same with other example as well:
struct Sbroken : Sa, Sb
{
using Sa::f;
using Sb::f;
};
Code : http://ideone.com/3hojd