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.
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.