[GCC-XML] Templated classes and default constructors

Brad King brad.king at kitware.com
Tue Mar 10 13:38:05 EDT 2009


Jason Roelofs wrote:
>   typedef TemplateAdder<int> IntAdder;
[snip]
> But for TemplateAdder and IntAdder I have simply:
> 
> <Class id="_1480" name="TemplateAdder<int>" context="_60"
> incomplete="1" mangled="N7classes13TemplateAdderIiEE"
> demangled="classes::TemplateAdder<int>" location="f60:29"
> file="f60" line="29" artificial="1" align="8"/>
> 
> Is this simply what GCC reports back? I can work with this just fine,
> I'm just wondering as if I could get generated entries for all classes
> it would make this feature I'm working on a little simpler.

See FAQ#5:  http://www.gccxml.org/HTML/FAQ.html

You need to convince the compiler to instantiate the template.  Accessing
one member will do this:

   typedef TemplateAdder<int>::TemplateAdder IntAdder;

In general this should be done only in code seen by gccxml and not by
normal compilers.  Otherwise you will cause lots of unnecessary work
for the compiler when building your code.  You can use the __GCCXML__
preprocessor symbol to distinguish it.

-Brad



More information about the gccxml mailing list