D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4109 - writeln doesn't work with empty static array
Summary: writeln doesn't work with empty static array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2010-04-21 13:48 UTC by bearophile_hugs
Modified: 2015-06-09 05:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-04-21 13:48:33 UTC
This D2 code:

import std.stdio: writeln;
void main() {
    int[0] a;
    writeln(a);
}


dmd 2.043 shows:

[...]\dmd\src\phobos\std\format.d(2040): Error: array index 0 is out of bounds obj[0 .. 0]
[...]\dmd\src\phobos\std\format.d(2040): Error: array index 0 is out of bounds [0..0]
Comment 1 Shin Fujishiro 2010-05-23 05:00:48 UTC
Fixed in svn r1546.
Comment 2 bearophile_hugs 2010-06-14 04:39:14 UTC
Reopened. Phobos needs to be debugged with warnings on. If I compile that program with:

dmd -w test.d

DMD 2.047 prints:
...\src\phobos\std\format.d(2040): Warning: statement is not reachable
...\src\phobos\std\format.d(2041): Warning: statement is not reachable
Comment 3 Shin Fujishiro 2010-06-14 08:42:42 UTC
Okay, I fixed it in svn r1642.