Puzzling error message about templates (gcc 3.4.0)
Giovanni Bajo
giovannibajo@libero.it
Thu Jun 10 23:50:00 GMT 2004
Paul Koning wrote:
> Ian> It is somewhat better in the current sources:
>
> Ian> foo.cc:12: error: invalid use of constructor as a template
> Ian> foo.cc:12: note: use `Test<Type>::Test' instead of
> Ian> `Test<Type>::Test<Type>' to name the constructor in a qualified
> Ian> name foo.cc:15: error: non-template `Test' used as template
> Ian> foo.cc:15: error: (use `Test<Type>::template Test' to indicate
> Ian> that it is a template) foo.cc:15: error: expected class-name at
> Ian> end of input foo.cc:15: error: expected init-declarator at end
> Ian> of input foo.cc:15: 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?
Thanks!
Giovanni Bajo
More information about the Gcc
mailing list