Bug 4715 – Bad error message with update for already defined variable

Status
RESOLVED
Resolution
INVALID
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-08-22T19:48:00Z
Last change time
2013-11-16T23:06:52Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-08-22T19:48:41Z
This wrong D2 program: void main() { int foo = 1; int foo = 1; } Produces a good error message (dmd 2.048): test.d(3): Error: declaration test.main.foo is already defined But this similar wrong program: void main() { int foo = 1; int foo -= 1; } Produces two wrong error messages: test.d(3): semicolon expected, not '-=' test.d(3): found '-=' instead of statement I'd like this second situation to generate the same error as before.
Comment #1 by yebblies — 2013-11-16T23:06:52Z
The second case has a syntax error, and doesn't get through parsing. There is no way to get semantic errors if it won't parse.