[Bug c++/54377] New: Consider default arguments in "wrong number of template arguments" diagnostic
zeratul976 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Aug 25 23:51:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54377
Bug #: 54377
Summary: Consider default arguments in "wrong number of
template arguments" diagnostic
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zeratul976@hotmail.com
Consider the following (invalid) code:
template <typename, typename, typename = void, typename = void>
struct foo {};
int main()
{
foo<int> f;
}
The error message GCC gives is:
test.cpp: In function 'int main()':
test.cpp:6:12: error: wrong number of template arguments (1, should be 4)
foo<int> f;
^
test.cpp:2:8: error: provided for 'template<class, class, class, class> struct
foo'
struct foo {};
^
I think the "1, should be 4" part is misleading, since 2 or 3 template
arguments would also be valid.
I think the error message should be changed to:
test.cpp: In function 'int main()':
test.cpp:6:12: error: wrong number of template arguments (1, should be 2 to 4)
foo<int> f;
^
test.cpp:2:8: error: provided for 'template<class, class, class, class> struct
foo'
struct foo {};
^
More information about the Gcc-bugs
mailing list