This fails to compile void main() { { int nestedFunc(int val) { return val; } } { float nestedFunc(float val) { return val; } } } with the error d.d(10): Error: declaration nestedFunc is already defined in another scope in main The functions are in separate scopes. No name shadowing is occurring. I don't see why they can't both exist. If they were variables, there would be no problem. Obviously, this is intentional given the specificity of the error message, but it seems overly restrictive to me. So, I'm submitting it as a feature request that nested functions be allowed to have the same name if they're in separate scopes and no name shadowing/hiding can occur.
Seems like a minor limitation, and getting different mangling
(In reply to Dmitry Olshansky from comment #1) > Seems like a minor limitation, and getting different mangling for each of identical signature functions: void main() { { int nestedFunc(int val) { return val+1; } } { int nestedFunc(int val) { return val+2; } } }
*** This issue has been marked as a duplicate of issue 4699 ***