gcc v3.4.4; templates and compile errors

Magyar, Thomas J. CIV NAVAIR thomas.magyar@navy.mil
Thu Jun 23 19:30:00 GMT 2005


In upgrading from gcc v3.3 to gcc v3.4.4 on an SGI IRIX 6.5, I'm having a compile error that I can not figure out. We're trying to build the SAX library, and in one of the files (saxlibxml2.h) there is a function that a line is giving me an error:

template<class stringT, class string_adapterT>
std::auto_ptr<typename basic_XMLReader<stringT>::PropertyBase> libxml2_wrapper<stringT, string_adapterT>::doGetProperty(const stringT& name)
{
  if(name == properties_.declHandler)
  {
-->    SAX::basic_XMLReader<stringT>::Property<SAX::basic_DeclHandler<stringT> *>* prop;

    prop = new SAX::basic_XMLReader<stringT>::Property<SAX::basic_DeclHandler<stringT>*>(declHandler_);

    return std::auto_ptr<typename SAX::basic_XMLReader<stringT>::PropertyBase>(prop);
  }

  ...
}

The line beginning with SAX:: is giving us this compile error:

SAX/wrappers/saxlibxml2.h:310: error: expected primary-expression before '*' token


Not very helpful really. In playing around with the line of code and trying to narrow it down, I have found out that if I replace all the '<stringT>' in that line (there are 4 instances of it) with '<int>' it compiles without warning. But obviously, it won't work as intended. So it is something to do with the 'stringT'. Yet there are other functions in this file that use stringT and with no compile errors. 

Does anyone who is good with templates have any ideas in what I may be missing? I'm only familiar with basic templates...this code is what I call template hell!

Thanks,

Tom



More information about the Gcc-help mailing list