Why does the following compile in GCC 4.8 (g++)? Isn't it completely ill-formed?
void test(int x)
{
return test(3);
}
int main() {}
- I'm trying to use the result of calling
test, which does not exist - I'm trying to return a value from
test
Both should be fundamentally impossible — not just UB, as far as I can recall — with a void return type.
The only warning I get is about x being unused, not even anything about a non-standard implicit return type being added.