[Solved] Why compiler gives the message “call of overloaded function is ambiguous” here in C++11?


You have a member function:

void func_A(int a, T initvalue = T()) {}

that can be called like this:

mc.func_A(1);

Then you have an overloaded member function:

  void func_A(int a) {}

that can also be called like this:

 mc.func_A(1);

How could the compiler know which function you intend to call by that line? Answer: It can not. Such ambiguous function call is ill-formed. Solution: Remove either the overload or the default argument so that there is no ambiguity.

solved Why compiler gives the message “call of overloaded function is ambiguous” here in C++11?