Richard, based on your guidance in: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130624/082605.html , attached is a patch that fixes a tinyish bug in template instantiation that causes an assertion violation during PCH writing, which assumes no local implicit instantiations are pending at the end of the translation unit.
As noted by Richard in the linked to post, the following code should
not add an entry
into PendingLocalImplicistInstantiations, since local instantiations
should only occur
within the context of other instantiations.
int foo(double y) {
struct Lambda {
template<class T> T operator()(T t) const { return t; };
} lambda;
return lambda(y);
}
Hence the attached code does the following:
1) In MarkFunctionReferenced, check if ActiveInstantiations.size() is non-zero
before adding to PendingLocalImplicitInstantiations.
2) In InstantiateFunctionDefinition, we swap out/in
PendingLocalImplicitInstantiations
so that only those pending local instantiations that are added
during the instantiation
of the current function are instantiated recursively.
Thanks!
Faisal Vali
fix-pending-local-instantiations-for-pch.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
