Bug 1129 – ICE, expression.c line 6246, accessing element of a tuple built from a nonexistent array element
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-04-12T06:14:00Z
Last change time
2014-02-16T15:26:16Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Comments
Comment #0 by matti.niemenmaa+dbugzilla — 2007-04-12T06:14:01Z
template Foo(T...) {
typeof(T[0]) x;
}
alias Foo!(""[$]) foo; // can't use e.g. [][0] because it's detected as out of bounds
--
Output of the above:
asdf.d(5): Error: expression [][__dollar] is not a valid template value argument
Assertion failure: 'e1->type' on line 6246 in file 'expression.c'
abnormal program termination
--
Using "" in place of [] as an empty array instead generates the rather incorrect error message:
asdf.d(5): Error: string index 0 is out of bounds [0 .. 43867541830893568]
Comment #1 by thomas-dloop — 2007-04-27T13:08:11Z
I can't reproduce the assertion with DMD-1.011 but I do get a funny error
message:
a.d(16): Error: string index 0 is out of bounds [0 .. 14721601702461440]
Strictly speaking the sample should compile because the compiler claims that
the array contains 14721601702461441 elements and thus there has to be a first
element <g>
Comment #2 by matti.niemenmaa+dbugzilla — 2007-04-28T04:03:57Z
Yes, I show that error message at the end of the post as well. My mistake that I left the ""[$] in the example code: use [][$] instead of ""[$], and it asserts as late as 1.013.
In 1.014, I get the following errors, so I'm marking this as FIXED:
asdf.d(5): Error: expression [][__dollar] is not a valid template value argument
asdf.d(2): variable asdf.Foo!([][__dollar]).x voids have no value
asdf.d(5): template instance asdf.Foo!([][__dollar]) error instantiating
I'll file a separate Bug for the ""[$] issue.