Summary: Cannot use the same name for nested functions even
                    though they're in different scopes
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from Jonathan M Davis <> 2010-09-19 01:11:25 
PDT ---
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

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.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to