Description of new feature
I've found that BestOverloadFunctionMatch doesn't select any member function if one is const. It also doesn't support overloading based on & or &&.
struct bar
{
int foo(int i)
{
return i;
}
int foo(int i) const
{
return i + 1;
}
};
If the second foo is commented out, I can match the first member fn and call it no problem. But when both are present, neither matches.
This also brings up the important point that BestOverloadFunctionMatch doesn't take into account the constness or the value category of the invoking object. So matching const member fns or matching & or && member fns cannot be done without specifying more information to overload resolution.
I think we should be able to solve this by having the invoking object as the first argument and then resolve on that. Right now, BestOverloadFunctionMatch actually expects that it's not present. So, in my example above, the only argument would be one int.
If instead we need to provide a bar const& and int then we can match the overload on constness and value category of the invoking object.
@Vipul-Cariappa for vis.
Description of new feature
I've found that
BestOverloadFunctionMatchdoesn't select any member function if one isconst. It also doesn't support overloading based on&or&&.If the second
foois commented out, I can match the first member fn and call it no problem. But when both are present, neither matches.This also brings up the important point that
BestOverloadFunctionMatchdoesn't take into account the constness or the value category of the invoking object. So matchingconstmember fns or matching&or&&member fns cannot be done without specifying more information to overload resolution.I think we should be able to solve this by having the invoking object as the first argument and then resolve on that. Right now,
BestOverloadFunctionMatchactually expects that it's not present. So, in my example above, the only argument would be oneint.If instead we need to provide a
bar const&andintthen we can match the overload on constness and value category of the invoking object.@Vipul-Cariappa for vis.