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: Puzzling error message about templates (gcc 3.4.0)

Paul Koning wrote:

>  Ian> It is somewhat better in the current sources:
>  Ian> error: invalid use of constructor as a template
>  Ian> note: use `Test<Type>::Test' instead of
>  Ian> `Test<Type>::Test<Type>' to name the constructor in a qualified
>  Ian> name error: non-template `Test' used as template
>  Ian> error: (use `Test<Type>::template Test' to indicate
>  Ian> that it is a template) error: expected class-name at
>  Ian> end of input error: expected init-declarator at end
>  Ian> of input error: expected `;' at end of input
>  Ian> (Shouldn't the fourth line by note instead of error?)
> Probably

Yes, it's cp/parser.c around line 8193 if you feel like testing a little patch.

> That new message for line 12 helps a lot.  The surprise is that the
> parser doesn't recognize line 15 as an analogous mistake, i.e.,
> "Invalid use of destructor as a template.... use Test<Type>::~Test
> instead of ..."

I added the new error message for that line, would you please file a bug report
for the destructor case and assign it to me?


Giovanni Bajo

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