This is the mail archive of the 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]
Other format: [Raw text]

Re: C++ PATCH: PR 9849

On Sun, 30 Nov 2003 22:02:04 -0800, Mark Mitchell <> wrote:

> PR 9849 is a case where the error messages generated by the new parser
> for an invalid template construct were not very good.  For this code:
>   template<class T> struct C1
>   {
>     template<class U> struct C2
>     { class Type { }; };
>   };
>   template<class T, class U>
>   void foo(typename C1<T>::C2<U>::Type *) { }
> we now say:
>   test.C:8: error: non-template `C2' used as template
>   test.C:8: error: (use `C1<T>::template C2' to indicate that it is a template)
> which is just about ideal.

Should we even be requiring "template" in a typename?  We know that we need
a type, so there's no other valid interpretation for that input.  You might
check that, rather than whether or not we're in a declaration.

Issue 343 is this question.  It hasn't been addressed by the committee yet,
but allowing the testcase would be consistent with the resolutions of 180
and 314.

I would suggest allowing the testcase with a pedwarn.

> If you don't know what construct must come at a given location
> (becuase there is more than one choice), it's hard to give good error
> messages.

Yep, helpful error messages require an educated guess about what the user
might be trying to do.


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