[Bug c++/14964] ICE on missing "template"

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Thu Apr 15 19:22:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-04-15 18:06 -------
This is already fixed. Here's a smaller testcase: 
--------------------- 
#include <vector> 
 
template <typename> 
struct S { 
    template <typename T> 
    struct vector : std::vector<T> {}; 
}; 
 
template <typename T> 
struct X : std::vector<int> { 
    typedef typename S<T>::vector<int>::iterator iterator; 
}; 
 
template <typename T> 
void foo(X<T> &x) { 
  typename X<T>::iterator i;  
  i != x.end(); 
} 
 
template 
void foo(X<int> &x); 
---------------------------- 
Note the missing "template" in line 11. This gives: 
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc 
x.cc: In function `void foo(X<T>&) [with T = int]': 
x.cc:21:   instantiated from here 
x.cc:16: error: `i' has incomplete type 
x.cc:16: error: storage size of `i' isn't known 
x.cc:21:   instantiated from here 
x.cc:17: internal compiler error: in arg_assoc_type, at cp/decl2.c:4339 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
This is fixed in 3.4 and mainline: 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc 
x.cc:11: error: non-template `vector' used as template 
x.cc:11: error: (use `S< <template-parameter-1-1> >::template vector' to 
indicate that it is a template) 
x.cc:11: error: declaration does not declare anything 
 
That's actually a pretty good error message! 
 
The whole thing compiles, though, if I add the missing "template", which 
also has to be expected. 
 
Previous compilers also ICEd on this, so this is not a regression. I thus 
close it as "fixed". 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
      Known to fail|                            |2.95.3 3.2.3 3.3.3
      Known to work|                            |3.4.0 3.5.0
         Resolution|                            |FIXED
            Summary|internal compiler error on  |ICE on missing "template"
                   |legal code                  |
   Target Milestone|---                         |3.4.0


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



More information about the Gcc-bugs mailing list