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++/15339] function call error


------- Additional Comments From bangerth at dealii dot org  2004-05-07 15:30 -------
Confirmed, here is a smaller testcase: 
----------- 
template<typename> void fun(int); 
template<typename> void fun(int = 0) {}  
 
int main()  
{ fun(); } 
----------- 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc 
x.cc: In function `int main()': 
x.cc:10: error: no matching function for call to `fun()' 
 
However, we get this from icc: 
g/x> icc -Xc -ansi x.cc 
x.cc(2): warning #845: specifying a default argument when redeclaring an 
unreferenced function template is nonstandard 
  template<typename> void fun(int = 0) {}  
                          ^ 
 
x.cc(5): error: no instance of function template "fun" matches the argument 
list 
  { fun(); } 
    ^ 
 
compilation aborted for x.cc (code 2) 
 
 
So it seems that this is wrong code. Someone will have to look up the exact 
text in the standard though. I find it odd that this only applies to  
templates, not to non-template functions. 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15339


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