www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Block Statement scope

reply Marcio Faustino <Marcio_member pathlink.com> writes:
Hi all,

The examples func2() and func3() from
http://www.digitalmars.com/d/statement.html compile without any warning, where
it should be an error.

--
Marcio Faustino
Jan 27 2006
parent reply Roberto Mariottini <Roberto_member pathlink.com> writes:
In article <drcmmp$kuh$1 digitaldaemon.com>, Marcio Faustino says...
Hi all,

The examples func2() and func3() from
http://www.digitalmars.com/d/statement.html compile without any warning, where
it should be an error.
IIRC, from a long discussion in the D newsgroup, it was later decided that func3 should be legal code, while func2 and func4 should issue an error. Ciao --- http://www.mariottini.net/roberto/
Jan 27 2006
parent reply Marcio Faustino <Marcio_member pathlink.com> writes:
In article <drcpts$o9s$1 digitaldaemon.com>, Roberto Mariottini says...
In article <drcmmp$kuh$1 digitaldaemon.com>, Marcio Faustino says...
Hi all,

The examples func2() and func3() from
http://www.digitalmars.com/d/statement.html compile without any warning, where
it should be an error.
IIRC, from a long discussion in the D newsgroup, it was later decided that func3 should be legal code, while func2 and func4 should issue an error. Ciao --- http://www.mariottini.net/roberto/
Sorry I didn't know that, but still func2() should cause a compile error. -- Marcio Faustino
Jan 27 2006
parent =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
Marcio Faustino wrote:
 In article <drcpts$o9s$1 digitaldaemon.com>, Roberto Mariottini says...
 In article <drcmmp$kuh$1 digitaldaemon.com>, Marcio Faustino says...
 Hi all,

 The examples func2() and func3() from
 http://www.digitalmars.com/d/statement.html compile without any warning, where
 it should be an error.
IIRC, from a long discussion in the D newsgroup, it was later decided that func3 should be legal code, while func2 and func4 should issue an error. Ciao --- http://www.mariottini.net/roberto/
Sorry I didn't know that, but still func2() should cause a compile error.
Confirmed with dmd 0.147 on linux. func2() should produce an error, but it doesn't. There's also an error in the docs - func3() should be legal, because previous x is introduced in it's own scope inside the first block. -- Jari-Matti
Feb 16 2006