[Issue 1199] New: Strange error messages when indexing empty arrays or strings at compile time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 28 02:13:17 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1199
Summary: Strange error messages when indexing empty arrays or
strings at compile time
Product: D
Version: 1.011
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: trivial
Priority: P3
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: deewiant at gmail.com
// Error: non-constant expression [][__dollar - 1u]
char a = (cast(char[])[])[$-1];
Using an immediate value like 0 in place of $-1 gives the sensible message
explaining that the index is out of bounds.
// Error: string index 4294967295 is out of bounds [0 .. 17540474638172160]
char b = ""[$-1];
Doesn't help here, though:
// Error: string index 0 is out of bounds [0 .. 17540474638172160]
char c = ""[0];
// Ditto
char d = ""[$];
--
More information about the Digitalmars-d-bugs
mailing list