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.