Re: gcc v3.4.4; templates and compile errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It looks like you're missing a "typename" keyword on that line.

The reason int works is because that removes the dependency from the
template parameters.

typename SAX::basic_XMLReader<stringT>::Property<typename
SAX::basic_DeclHandler<stringT> *>* prop;

More information on this whole requirement is under the C++ section
of: http://gcc.gnu.org/gcc-3.4/changes.html

corey

On 6/23/05, Magyar, Thomas J.  CIV NAVAIR <thomas.magyar@xxxxxxxx> wrote:
> 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
> 
>


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux