Get a more detailed template in gcc or clang diagnostics

If an error occurs when expanding templates, the compiler prints a chain of created templates. In an earlier version of gcc, the trace looked like (edit: it actually looks like creating function templates, but not for class templates)

... while expanding whatever<X, Y, Z> with [X=int, Y=double, Z=other]

but in g ++ 4.8 and clang ++ 3.3 it looks like

required from whatever<int, double, other>

Although this is shorter, it is also completely unreadable when the template contains 10 arguments, and most of them are templates, the arguments of which, in turn, are more than templates and so on at several levels. Then it just melts into a completely incomprehensible mess of angle brackets (which are not considered as brackets in the editor, so it's hard to even copy and copy and format it).

Is there a way to force a more verbose format from one of the two compilers?

If there was a way to further expand it to split lines like

... while expanding whatever<X, Y, Z> with
    X=int
    Y=double
    Z=other

(a bit like MSC ++), that would be nice.

+4
source share

Source: https://habr.com/ru/post/1527841/


All Articles