digitalmars.D.learn - DMD D Compiler warnings
- Marcio Faustino (17/17) Jan 26 2006 Hi all,
- Don Clugston (7/32) Jan 26 2006 Confirmed. Definitely a bug. Actually this should be an error, not a
- Derek Parnell (7/24) Jan 29 2006 I believe this is a mistake in the documentation. A block begins a new
- Bruno Medeiros (12/37) Jan 31 2006 Recall this:
Hi all, I have this simple program: int main() { int x; { int x; // illegal, x is multiply defined in function scope } return 0; } And according to the lexical for statements (http://www.digitalmars.com/d/statement.html) it should be illegal to re-define x. But, the DMD D Compiler (using version 0.144) doesn't warn anything about it. I'm compiling the program as: dmd main.d -w Any suggestions? Thanks, Marcio Faustino
Jan 26 2006
Marcio Faustino wrote:Hi all, I have this simple program: int main() { int x; { int x; // illegal, x is multiply defined in function scope } return 0; } And according to the lexical for statements (http://www.digitalmars.com/d/statement.html) it should be illegal to re-define x. But, the DMD D Compiler (using version 0.144) doesn't warn anything about it. I'm compiling the program as: dmd main.d -w Any suggestions? Thanks, Marcio FaustinoConfirmed. Definitely a bug. Actually this should be an error, not a warning. Looking at http://www.digitalmars.com/d/statement.html, the examples func2() and func3() compile without any complaint. This is probably a regression, I'm sure it used to work. Report it in digitalmars.d.bugs.
Jan 26 2006
On Thu, 26 Jan 2006 20:51:15 +1100, Marcio Faustino <Marcio_member pathlink.com> wrote:Hi all, I have this simple program: int main() { int x; { int x; // illegal, x is multiply defined in function scope } return 0; } And according to the lexical for statements (http://www.digitalmars.com/d/statement.html) it should be illegal to re-define x. But, the DMD D Compiler (using version 0.144) doesn't warn anything about it. I'm compiling the program as: dmd main.d -w Any suggestions?I believe this is a mistake in the documentation. A block begins a new scope. -- Derek Parnell Melbourne, Australia
Jan 29 2006
Marcio Faustino wrote:Hi all, I have this simple program: int main() { int x; { int x; // illegal, x is multiply defined in function scope } return 0; } And according to the lexical for statements (http://www.digitalmars.com/d/statement.html) it should be illegal to re-define x. But, the DMD D Compiler (using version 0.144) doesn't warn anything about it. I'm compiling the program as: dmd main.d -w Any suggestions? Thanks, Marcio FaustinoRecall this: "Entity name shadowing: valid or not ?" http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.learn/1979 Last word I got from Walter ( http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.announce/1872 ) he himself wasn't sure about those. I think the func2 case should be allowed (that is, name shadowing with a new scope). -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
Jan 31 2006