When a template is instantiated after a fatal error has occurred,
template instantiation is aborted. In that case, we need to mark the
instantiated decl as invalid, otherwise we try to access it later.
Details
Details
Diff Detail
Diff Detail
Event Timeline
lib/Sema/SemaTemplateInstantiate.cpp | ||
---|---|---|
1930–1939 | Is it sufficient to move this block of code to after the bail-out below? It seems like the problem may be that we've done some amount of the instantiation work (storing the TSK on the specialization) before we bail out, and so the AST is left in an inconsistent state. |
Comment Actions
This fix LGTM, but I do wonder about one thing. The following pattern seems to occur all over Sema:
InstantiatingTemplate Inst(*this, PointOfInstantiation, Decl); if (Inst.isInvalid()) ...
For example, in Sema::InstantiateEnum. Why aren't we marking decls invalid in those other places?
lib/Sema/SemaTemplateInstantiate.cpp | ||
---|---|---|
2273–2297 | Better solution: just delete all of this code. |
Is it sufficient to move this block of code to after the bail-out below? It seems like the problem may be that we've done some amount of the instantiation work (storing the TSK on the specialization) before we bail out, and so the AST is left in an inconsistent state.