[Dwarf-Discuss] Template parameter packs and template template parameters

Jason Merrill jason@redhat.com
Fri Aug 28 00:45:23 GMT 2009

...are two C++ features that are not currently represented in DWARF. 
We're adding them to G++ using the extensions described at


To restate:

For template template parameters, we're just using the source name of 
the template given as an argument so that the consumer can use its 
normal name resolution procedure: i.e. for

template <template <class> class T>
struct A
   int f() { T<int> t; return t.u; }

template <class U>
struct B
   U u;

int main()
   A<B> a;

within A<B>::f() we can ask the debugger what T<int> looks like, and it 
can think "well, T is a template template parameter, and the 
corresponding argument is "B", so I'll rewrite that as B<int>, which I 
know how to find".

A solution like this seems better to me than trying to describe unbound 
templates in DWARF.


For template parameter packs, we're just dealing with them by describing 
them in DWARF as multiple template parameters, so for

template <class... Ts>
struct A
   void f() { ... }

we just pretend that instead of one parameter pack Ts, A has multiple 
parameters Ts#0, Ts#1, etc.




More information about the Dwarf-discuss mailing list