This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loki's tricky templates


At 17:48 21/4/01 +0200, Paolo Carlini wrote:
>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.

I take it back about the part that it's still a language issue.  (I was 
confused
with some other issues with the usage of 'template' keyword.)  The Loki's
syntax is not ISO C++ but the correct one is.  The 'template' keyword 
requirement
is mentioned in section 14.2 paragraph 4 and 5 of the standard.

>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!

A standard-compliant compiler should reject the original version and accept
the modified one.

>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):

Right.  It's an unimplement feature right now.  It should present in gcc 3.1.
I'll work on an implementation of this in a couple months.

--Kriang


>--------
>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]