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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 22 11:11:41 PDT 2012


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


dawg at dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dawg at dawgfoto.de


--- Comment #36 from dawg at dawgfoto.de 2012-03-22 11:11:55 PDT ---
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.

- 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