Consider the following, minimal example:
struct T { void operator()() { } };
struct S { void operator()(int) { } };
struct U: T, S {
U(): T{}, S{} { }
//using T::operator();
//using S::operator();
};
int main() {
U u;
u(42);
}
It compiles as it is with clang 3.8.
Anyway, it fails to compile with GCC 6.1 with the error:
12 : error: request for member 'operator()' is ambiguous
Note that GCC 6.1 works fine if the using
directives are uncommented.
As far as I know, there is no reason for such an error and it seems that clang is the one that works as expected.
Before to open a bug to I don't know who, I'd like to ask if there is something that I missed.
In other terms, to give an error is the right behavior in this case or it's an error for itself?