[Bug c++/19741] suboptimal error message for template functions (as opposed to non-templates)
gdr at integrable-solutions dot net
gcc-bugzilla@gcc.gnu.org
Tue Feb 1 16:05:00 GMT 2005
------- Additional Comments From gdr at integrable-solutions dot net 2005-02-01 16:04 -------
Subject: Re: suboptimal error message for template functions (as opposed to non-templates)
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| This is in fact true. There is a mismatch between error messages for
| template function arguments and non-templates:
| --------------------
| void foo1();
| template <typename> void foo2();
|
| template <typename> bool bar(void (*) () );
|
| bool b1 = bar<int> (1, &foo1);
| bool b2 = bar<int> (1, &foo2<int>);
| --------------------
| g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -c x.cc
| x.cc:6: error: no matching function for call to ?bar(int, void (*)())?
| x.cc:7: error: no matching function for call to ?bar(int, <unknown type>)?
|
| Since the complete template arguments to foo2 are given, the type should
| in fact be completely known.
Agreed.
(More generally, I think the C++ front-end should have a type for
overload set and -- by means of implication for templates too -- to
better capture user mistakes.)
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19741
More information about the Gcc-bugs
mailing list