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


Don <clugd...@yahoo.com.au> changed:

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




--- Comment #2 from Don <clugd...@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: -------

Reply via email to