Bug 24848 – bad parser diagnostic for a partial MulExp

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-11-08T04:59:45Z
Last change time
2024-11-10T09:21:21Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
basile-z

Comments

Comment #0 by b2.temp — 2024-11-08T04:59:45Z
given the wrong code: ``` module runnable; void main() { struct A1 {} if (A1*) {} return; } ``` you get the error messages > /tmp/temp_7FA97E5E13D0.d(6,12): Error: expression expected, not `)`> > /tmp/temp_7FA97E5E13D0.d(6,14): Error: missing closing `)` after `if (A1 * 0` The second message is very bad. First it does not output the input. In no way we multiply by zero. Second the closing right paren is there.
Comment #1 by dlang-bot — 2024-11-08T12:51:13Z
@ntrel created dlang/dmd pull request #17055 "Fix Bugzilla 24848 - bad parser diagnostic for a partial MulExp" fixing this issue: - Fix Bugzilla 24848 - bad parser diagnostic for a partial MulExp https://github.com/dlang/dmd/pull/17055
Comment #2 by nick — 2024-11-08T12:53:49Z
> In no way we multiply by zero. This happens for pretty much any binary expression, the pull fixes that. This is the main bug IMO. > Second the closing right paren is there. I think there are many cases where subsequent parser error messages are confusing.
Comment #3 by dlang-bot — 2024-11-10T09:21:21Z
dlang/dmd pull request #17055 "Fix Bugzilla 24848 - bad parser diagnostic for a partial MulExp" was merged into master: - 5d01f144e2cc63a9c1c0edd5ab954a8edac11403 by Nick Treleaven: Fix Bugzilla 24848 - bad parser diagnostic for a partial MulExp https://github.com/dlang/dmd/pull/17055