[Issue 3006] ICE(e2ir.c, tocsym.c) template module using array operation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 3 16:07:41 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3006


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch




--- Comment #2 from Don <clugdbug at yahoo.com.au>  2009-06-03 16:07:40 PDT ---
Root cause: semantic3 never gets run on the function which 
is created, if it's compiled in a module which doesn't instantiate the
template it's in. To fix this, we can run its semantic3 immediately, since
we're already in semantic3 for this module.
BTW: It also seems to me that the back-end should have
assert(FuncDeclaration->semanticRun==4) before running toObj(), to ensure
semantic3 has been run (it would be a better place to ICE).
BTW: FuncDeclaration::toObj() is declared but never defined or used.

PATCH: Add this code to arrayop.c, BinExp::arrayOp, line 393.

        sc->linkage = LINKc;
        fd->semantic(sc);
+          fd->semantic2(sc);
+          fd->semantic3(sc);
        sc->pop();

// TEST CASE 1. Compilation order is important.
dmd bugx.d bug.d
------
bug.d
------
import bugx;
void main(){
    foo!(long)();
}
------
bugx.d
------
void foo(T)() {
   long[] a;
   a[] = -a[];
}
// TEST CASE 2: replace bugx with:
void foo(T)() {
   T[] a;
   a[] = -a[];
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list