When compiling the following code:  
 
-----------------<test.cc>------------------- 
// Trigger ICE with invalid input.  
// Wolfgang Wieser 03/2005.  
 
int foo(some_type x);   // some_type is unknown here by purpose.  
template<typename T>int foo(T x) {} 
-------------------------------------------- 
 
...gcc will crash with the following output:  
 
-------------------------------------------- 
test.cc:4: error: 'some_type' was not declared in this scope 
test.cc:5: error: 'template<class T> int foo(T)' redeclared as different kind 
of symbol 
test.cc:4: error: previous declaration of 'int foo' 
 
 
Internal compiler error: Error reporting routines re-entered. 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
-------------------------------------------- 
 
Obviously the code is invalid because "some_type" has not been declared.  
 
Versions checked by me:  
4.0.0: 20050219 (exp.): ICE 
4.1.0: 20050312 (exp.): ICE 
3.4.x: work correctly

-- 
           Summary: ICE on invalid C++ code
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wwieser at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu


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

Reply via email to