Thread overview
[Issue 1129] New: ICE, expression.c line 6246, accessing element of a tuple built from a nonexistent array element
Apr 12, 2007
d-bugmail
Apr 27, 2007
d-bugmail
Apr 28, 2007
d-bugmail
April 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1129

           Summary: ICE, expression.c line 6246, accessing element of a
                    tuple built from a nonexistent array element
           Product: D
           Version: 1.011
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: deewiant@gmail.com


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]


-- 

April 27, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1129





------- Comment #1 from thomas-dloop@kuehne.cn  2007-04-27 13:08 -------
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>


-- 

April 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1129


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from deewiant@gmail.com  2007-04-28 04:03 -------
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.


--