Emit template backtrace in libtool diagnostics?

Hi All,

If I have a libtool processing code like this

template
struct C {
T *ptr; // error: cannot have a pointer to a reference
bool func() { } // error: must return a value
};

C<int &>;

there are two kinds of errors: one which results from a dependent template type substitution during template specialization, and one which is independent of the template context. Ideally, the tool’s diagnostics would emit a template backtrace in the former case, but not the latter.

How can this be done? I’m using the DiagnosticBuilder API, but it doesn’t provide any special functionality for dealing with templates.

Thanks in advance,

Scott Constable