This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19741] suboptimal error message for template functions (as opposed to non-templates)
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2005 16:04:47 -0000
- Subject: [Bug c++/19741] suboptimal error message for template functions (as opposed to non-templates)
- References: <20050201140539.19741.eda-qa@disemia.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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