Place the following code in a header file 'code.h' and compile a precompiled  
header with 'g++-4.0 -c code.h':   
template<typename T> void func()   
{   
        class object   
        {   
        public:   
                object() {} // Any function declaration produces an ICE.   
        };   
}   
   
code.h: In function 'void func()':   
code.h:6: internal compiler error: Segmentation fault   
Please submit a full bug report,   
with preprocessed source if appropriate.   
See <URL:http://gcc.gnu.org/bugs.html> for instructions.   
   
Compiling the code via 'g++-4.0 -c code.cpp' with 'code.cpp' containing the 
single line:   
#include "code.h"   
   
succeeds without error.    
gcc-3.4.3 does not exhibit this bug.   
  
I'm using 4.0.0 20050410 (prerelease) with Debian unstable on an Athlon-XP,  
gcc was configured as:   
../gcc-4.0.0-20050410/configure --enable-languages=c,c++   
--prefix=/usr/local/compilers --program-suffix=-4.0

-- 
           Summary: ICE when compiling c++ PCH of class definition within
                    template function.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simonjcan at yahoo dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to