Thanks! Adding a call to that from the constructor of my ASTConsumer
stops the crash.Now for my next mole!
Calling InstantiateFunction() is triggering diagnostics (irksome) and (it
appears) causes the tool to return a non-zero exit status (which is more
problematic for my use case).I tried creating a SFINAETrap on the stack, but it appears to do nothing,
I assume that this is because I somehow have to tell my Sema that it
shouldn't emit errors? I've also tried using a DiagnosticErrorTrap, and
that does notice the errors, but it also doesn't prevent the diagnostics
being output, or the exit status.
This is probably because the diagnostics are not in the "immediate context"
of the substitution (that is, they're not diagnostics that a SFINAE check
can detect, they're hard errors). We don't have a way to suppress those
diagnostics and return to a state as if the instantiation never happened
(the C++ language doesn't require such a mechanism). After such a
diagnostic occurs, parts of your AST might be marked as "invalid", and we
might suppress further diagnostics (possibly resulting in a later
instantiation succeeding when it would have failed if run from a clean
state). If you're OK with that, I think there's a flag on the
DiagnosticsEngine to suppress *all* diagnostics.