Bug 7385 – Bad error message missing line number on invalid array op that isn't special cased

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-28T00:44:00Z
Last change time
2012-07-14T12:09:32Z
Keywords
diagnostic, pull
Assigned to
yebblies
Creator
yebblies

Comments

Comment #0 by yebblies — 2012-01-28T00:44:27Z
void main() { immutable double[] nums = [1.0, 2.0]; nums[] /= nums[]; } Prints: DMD v2.058 DEBUG Error: p1[p] isn't mutable When it should print: testx.d(12): Error: slice nums[] is not mutable Normal because of the missing line number
Comment #1 by yebblies — 2012-01-28T00:49:48Z
This bug also bypasses gagging: void main() { immutable double[] nums = [1.0, 2.0]; static assert(!is(typeof({ nums[] /= nums[]; }))); } Still prints the error.
Comment #2 by lovelydear — 2012-04-21T05:26:43Z
The second test no longer prints an error on 2.059
Comment #3 by k.hara.pg — 2012-07-14T07:40:38Z
(In reply to comment #1) > This bug also bypasses gagging: > > void main() > { > immutable double[] nums = [1.0, 2.0]; > static assert(!is(typeof({ nums[] /= nums[]; }))); > } > > Still prints the error. (In reply to comment #2) > The second test no longer prints an error on 2.059 The test case doesn't print error without -O switch, but with -O: $ dmd -O -run test Error: variable p1 used before set Error: variable p0 used before set It's another problem.
Comment #4 by k.hara.pg — 2012-07-14T08:05:54Z
Comment #5 by github-bugzilla — 2012-07-14T11:42:13Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ab7dd67616d93585da5748646cd1f1070480a88f fix Issue 7385 - Bad error message missing line number on invalid array op that isn't special cased This also fixes the problem of commented out test for issue 4662. Just calling error() function cannot stop the code generation while gagging errors. If errors exist, we should return ErrorExp. https://github.com/D-Programming-Language/dmd/commit/c56169b1fb0c4191361127666a136611ae6f7b6b Merge pull request #1046 from 9rnsr/fix7385 Issue 7385 - Bad error message missing line number on invalid array op that isn't special cased