digitalmars.D - re: Scope/block behaviour
- Eduardo Cavazos (11/17) Aug 20 2010 The compiler recognizes the situation and reports it as an error, so it
- Andrei Alexandrescu (6/24) Aug 21 2010 I think it is a bug. Technically I understand it - Walter names inner
void main () { { int f0 () { return 10 ; } } { int f0 () { return 20 ; } } }Stewart Gordon wrote:Looks like a bug.The compiler recognizes the situation and reports it as an error, so it seems like this is not a bug, but something which is not supported: ~/scratch $ rdmd test_scope_a.d test_scope_a.d(6): Error: declaration f0 is already defined in another scope in main The rationale in TDPL that Andrei pointed to doesn't seem to cover the case above. Can anyone confirm that the above really is against the rules of the language? Ed
Aug 20 2010
On 08/21/2010 01:21 AM, Eduardo Cavazos wrote:> void main () > { > { int f0 () { return 10 ; } } > > { int f0 () { return 20 ; } } > } Stewart Gordon wrote: > Looks like a bug. The compiler recognizes the situation and reports it as an error, so it seems like this is not a bug, but something which is not supported: ~/scratch $ rdmd test_scope_a.d test_scope_a.d(6): Error: declaration f0 is already defined in another scope in main The rationale in TDPL that Andrei pointed to doesn't seem to cover the case above. Can anyone confirm that the above really is against the rules of the language? EdI think it is a bug. Technically I understand it - Walter names inner functions like main.f0, which does not leave room for functions with the same name inside the same function. Shouldn't be difficult to fix though. Mind submitting a bug report please? Andrei
Aug 21 2010