Loki's tricky templates

Paolo Carlini pcarlini@unitus.it
Sat Apr 21 08:49:00 GMT 2001


Hi,

thanks for the very technical feedback!

So, please, let me recapitulate what you say:
1- That syntax, used in Loki, is not strictly ISO C++, but it is an issue in the
committee.
2- The correct syntax is presently that which you kindly explained, involving the
template keyword. In fact, a (commonly believed) very compliant compiler which rejected
the original code do compile fine a version modified according to your suggestion!
3- In any case, the current and past Gcc compilers are not able to deal with either the
current or the future syntax :(
Indeed, the segmention fault becomes just a plain error (I locally name the code
reduced.cpp):

--------
reduced.cpp:24: parse error before `>' token
reduced.cpp:33: syntax error before `(' token
reduced.cpp:33: missing ';' before right brace
reduced.cpp:31: ISO C++ forbids declaration of `DocElement' with no type
reduced.cpp:31: ISO C++ forbids declaration of `DocElement' with no type
--------

P.


Kriang Lerdsuwanakij wrote:

> Your code relies on a template template parameter feature (template
> template argument which scope is template parameter dependent) that
> has not been implemented in gcc yet.  It was missing from the C++
> standard as the language grammar doesn't allow it.  This now appears
> as an issue in the C++ standard committee.  The correct version
> of problematic code is shown below.
>
> template <typename R, class TList>
> class CyclicVisitor
>      : public GenScatterHierarchy<TList, VisitorBinder<R>::template Result>
>                                                                              ^^^^^^^
>                                                                          keyword
> required
>
> --Kriang



More information about the Gcc mailing list