www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1129] New: ICE, expression.c line 6246, accessing element of a tuple built from a nonexistent array element

reply d-bugmail puremagic.com writes:
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]


-- 
Apr 12 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1129






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>


-- 
Apr 27 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1129


deewiant gmail.com changed:

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





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.


-- 
Apr 28 2007