[Issue 2962] ICE(glue.c) or bad codegen passing variable as template value parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 23 01:48:25 PDT 2012


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



--- Comment #38 from Don <clugdbug at yahoo.com.au> 2012-03-23 01:48:04 PDT ---
(In reply to comment #36)
> cat > a.d << CODE
> import b;
> alias foo!() fooi;
> CODE
> 
> cat > b.d << CODE
> void foo()(int p)
> {
>     int inner()() { return p; }
>     alias inner!() finner;
> }
> CODE
> 
> dmd -c b a
> 
> --------
> 
> Slightly more reduced test case.
> 
> There are two things that should get fixed.
> 
> - We push template instances into the wrong object/module.
>   The module a template instance is attached to is found
>   by following the importedFrom chain. The head of the chain
>   should be the template declaration module not the instantiation
>   module. By doing so we guarantee that all instances remain
>   ordered and are bundled with their dependencies.

It's interesting how closely related that issue is to this one I posted
yesterday:
https://github.com/D-Programming-Language/dmd/pull/824
Fundamentally we need to sort out which module owns a function. I'm not sure
where the code belongs.

> 
> - VarDeclaration::toSymbol creates csym lazily.
>   I don't see any reason why this shouldn't apply to
>   parameters as well, e.g. replacing the 'p' parameter
>   with a local variable fixes the bug. So we should
>   just call v->toSymbol() and remove the assertion.

-- 
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