[Bug c++/99] Bug in template type in error message.

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 4 15:05:00 GMT 2005


------- Additional Comments From bangerth at dealii dot org  2005-03-04 15:05 -------
Here's another very nice example from PR 20313: 
------------------------- 
template<int j> struct s; 
template<int i> s<i>::s(int j) {} 
------------------------- 
Note that the definition of the constructor is invalid because the struct 
isn't complete. Here's what we get: 
g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -c x.cc 
x.cc:2: error: invalid use of undefined type ?struct s<j>? 
x.cc:1: error: declaration of ?struct s<j>? 
x.cc:2: error: template definition of non-template ?s<j>::s(int)? 
 
Note how the compiler uses the template argument 'j', although we use 
template argument 'i' in line 2! 
 
W. 

-- 


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



More information about the Gcc-bugs mailing list