[Qt-creator] Syntax highlighting, template templates

Nico Kruber kruber at zib.de
Mon Jul 6 14:06:29 CEST 2009


I'll try that (waiting for the compile to finish ;) )

In the meanwhile:
with today's snapshot I noticed another strange behaviour:
When opening a session which contains the file with this source, I do not get 
the errors, even when I switch to other files or build the app. Closing and 
opening that file again (or changing any text in it) shows the errors again.
(it's just a minor visualisation error though)

Also the following results in a similar error message (using the boost 
library):

template<std::size_t elements>
void setArray(boost::array<int, elements>* array) {
}
--> "'elements' is not a type name" (it isn't but that's fine, too ;) )


I'll report back later whether your patch fixes those issues

Nico

On Monday 06 July 2009 13:44:23 Roberto Raggi wrote:
> Hi Niko,
>
> please try this patch.
>
> ciao robe
>
> diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/
> cpptools/cppmodelmanager.cpp
> index 7d7dc94..53f1498 100644
> --- a/src/plugins/cpptools/cppmodelmanager.cpp
> +++ b/src/plugins/cpptools/cppmodelmanager.cpp
> @@ -373,6 +373,14 @@ protected:
>
>       virtual bool visit(TypenameTypeParameterAST *ast)
>       {
> +        if (NameAST *nameAst = ast->name)
> +            addType(nameAst->name);
> +
> +        return true;
> +    }
> +
> +    virtual bool visit(TemplateTypeParameterAST *ast)
> +    {
>           if (ast->name)
>               addType(ast->name->name);
>
> On Jul 6, 2009, at 1:22 PM, Nico Kruber wrote:
> > I've been working with template templates and there are still some
> > bugs in Qt
> > Creator's syntax highlighter which highlights my code suggesting it
> > has errors
> > (snapshot from 01/07/2009):
> >
> > --------------------
> >
> > template< template< typename > class Container, typename ElementType >
> > bool printSimulations(Container<Element> container){
> > }
> > --> "'Container<Element>' is not a type name"
> >
> > --------------------
> >
> > template< template< typename > class Container, typename ElementType >
> > bool printSimulations(Container<Element> container);
> > --> strangely this doesn't show any error
> >
> > --------------------
> >
> > template< template< typename > class Container, typename ElementType >
> > bool printSimulations(Container<Element> container, const QString&
> > path);
> > --> "'Container<Element>' is not a type name"
> > (adding an additional "typename" before Container works with the
> > syntax
> > highlighter, but not with g++ - QtCreator could instead complain
> > about that ;)
> > )
> >
> > --------------------
> >
> > template< template< typename > class Container, typename ElementType >
> >    bool printSimulations(Container<Element> container, const
> > QString& path) {
> >
> >  typename Container<Element>::const_iterator i =
> > container.constBegin();
> >  const typename Container<Element>::const_iterator end =
> > container.constEnd();
> >  while(i != end) {
> >    // do something
> >    ++i;
> >  }
> > }
> > --> "'Container<Element>' is not a type name" at the function
> > declaration
> > --> and "'Container is not a namespace or class name" shown at the
> > const_iterator lines
> >
> > --------------------
> >
> > Cheers,
> > Nico Kruber
> > _______________________________________________
> > Qt-creator mailing list
> > Qt-creator at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-creator
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20090706/884eb431/attachment.bin 


More information about the Qt-creator-old mailing list