Why the following code is well-formed:
void foo(int i, int j = 56);
void foo(int i = 42, int j);
int main(){ }
But the following
void foo(int i = 42, int j);
void foo(int i, int j = 56);
int main(){ }
is ill-formed. I tried to look up in the N4296::8.3.6 [dcl.fct.default]
and what I found was the following example:
class C
{
void f(int i = 3);
void g(int i, int j = 99);
};
void C::f(int i = 3) { } //error
void C::g(int i = 88, int j) { // C::g can be called with no argument
}
But clang doesn't seem that way.
struct A
{
void foo(int i = 42, int j);
};
void A::foo(int i, int j = 56){ }; //error
int main(){ }
So, is it an implementation issue? Formally, all this example should be acceptable, should they?