C++ member function overloading picks wrong function -
msvc throws error c2660 when trying overload global function member function (with different number of arguments) calls global function in it's body.
this code:
void f(int* x, int y) { *x += y; } struct { int* x; inline void f(int y) { f(x, y); // tries call a::f instead of f } void u(void) { f(5); } };
gives error:
error c2660: 'a::f' : function not take 2 arguments
use ::f(x, y);
use 1 in global namespace.
Comments
Post a Comment