[Bug c++/64446] Misleading error message when inheriting from a template class w/o the template params
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 9 12:59:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64446
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-03-09
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to petschy from comment #0)
> 'Base' is definitely a valid class name.
No it isn't, Base is a class template, and that is not a class. The error
message is completely accurate, although it could be improved to say how to fix
the code.
Clang also says:
p.cc:6:14: error: expected class name
struct Foo : Base
^
EDG gives a better error:
"p.cc", line 6: error: argument list for class template "Base" is missing
struct Foo : Base
^
"p.cc", line 6: error: not a class or struct name
struct Foo : Base
^
Ideally the compiler would recognise that Base is a template and point out that
the template argument list is missing.
More information about the Gcc-bugs
mailing list