[dmd-internals] Template instatiation order
Martin Nowak
dawg at dawgfoto.de
Wed Jun 29 13:56:42 PDT 2011
I recently stumbled over bug 2962.
http://d.puremagic.com/issues/show_bug.cgi?id=2962
Now the conclusion of this is, that semantic3 on a template instance with
alias parameter
must run strictly after it's instantiating parent.
The current way of adding instances back as members to their module
doesn't provide this,
as modules are analyzed in cmdline order.
Proposed solution:
- set up one array of Dsymbols
- each template instance get appended to it
- after each semantic stage of modules the semantic for all instances is
run
- before generating object code the instances are added back to their
module to distribute the comdats
Is it worth pursuing this approach? Would there be a better solution using
existing deferring mechanisms?
see attached patch for a hacked implementation
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-proof-of-concept-hack-for-ordered-template-instantia.patch
Type: application/octet-stream
Size: 3046 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20110629/1085cc66/attachment.obj>
More information about the dmd-internals
mailing list