This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/19741] suboptimal error message for template functions (as opposed to non-templates)


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]