According to some quotes in standard:
[over.match.funcs]/4
[...] For non-conversion functions introduced by a using-declaration into a derived class, the function is considered to be a member of the derived class for the purpose of defining the type of the implicit object parameter.
And consider the following code:
#include <iostream>
struct Base {
void show(double) {
std::cout << "0" << std::endl;
}
};
struct Test :Base {
using Base::show; //#1
void show(double) { //#2
std::cout << "1" << std::endl;
}
};
int main() {
Test t;
t.show(1.2);
}
According to the standard I cited,it means that take a implict object parameter of type Test
as that of #1
.
For #1
,the declaration would be show(Test&,double)
.
For #2
,the declaration would be show(Test&,double)
.
so in the purpose of overload resolution,the each implicit conversion sequence of #1
is indistinguishable with that of #2
,the invocation of t.show(1.2)
would be ambiguous,however #2
is called,why? if I miss something in the standard,please correct me.