This code:
#include <stdlib.h> // int abs(int);
int abs(int i = 0) { return 42; }
int main() {
return abs(1); // Returns 42
}
Returns 42
.
The compiler picks the overloaded C++ function. I tested this on many versions of g++/clang. Can I rely on this behaviour? Is it documented anywhere?