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


Rainer Schuetze <r.sagita...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagita...@gmx.de


--- Comment #30 from Rainer Schuetze <r.sagita...@gmx.de> 2011-01-30 08:07:38 
PST ---
I've also hit this issue today after updating to the latest dmd and runtime
from github.

As there is no hint where the problem is in my project, I took a look at the
last test case, and figured out a few things:

- the template instantiation for foo is added to module a, but the
instantiation of inner is added to module b.
- the error is triggered because the code for the inner function is generated
before the code for the outer function. Hence the reliance on the order of
modules on the command line.
- that made me think, that it might be ok to just skip the test, but the
following code shows, that it does not work because the inner function needs
the stack offset which is only calculated when the outer function is generated:

// module b
T foo(T)(T p, int q)
{
    T inner(U)() {
    return p;
    }
    return inner!int();
}

// module a
import b;

void main()
{
    assert(foo!int(5, 2) == 5);
}

fails for "dmd b.a b.d", but not for "dmd a.d b.d".

Is there a good reason why the inner function is generated into a different
module than the outer function?

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

Reply via email to