Scope/block behaviour
Eduardo Cavazos
wayo.cavazos at gmail.com
Fri Aug 20 23:21:24 PDT 2010
> 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
More information about the Digitalmars-d
mailing list