[Issue 21299] [LINK] undefined reference to dmd.root.stringtable.StringValue!(Type).StringValue.lstring()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 9 12:05:23 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21299

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject.org> ---
In `templateInstanceSemantic`, there is a shortcut for merging multiple
template instantiations originating from the same template decl.  It fixes up
the `minst` Module of the first instantiation to point at the root module
instead of a non-root module.

However, the first instantiation ran `tryExpandMembers`, which had set the
`_scope.minst` of all Dsymbol members to the non-root module.  This is left
intact despite their parent instance being updated.

Why is it important to note this?  In the event of handling forward references,
all further template instantiations from are pushed into that non-root module
that came from `_scope.minst`.  It is this that leads to undefined references
in both the mtype and func modules, they should have been pushed to the root
module, but `_scope.minst` is now incorrectly set.

A patch I am preparing for this adds a new Visitor to walk over all members and
update their `_scope.minst` to be the root module.

--


More information about the Digitalmars-d-bugs mailing list