GCC 3.4.0 release, bootstrapped native compiler for x86 linux. (Also happens with i686-linux cross-compiler to xscale-elf.) The authors of the code probably meant to declare the ByteCount constructor "explicit", but it shouldn't ICE just because they didn't. This is a regression from both GCC 2.95.3 and 3.3.2 -- they both compile this fine. Full compiler version: ---- Reading specs from /home/peter/gcc3temp/lib/gcc/i686-empeg-linux/3.4.0/specs Configured with: ../gcc-3.4.0/configure --build=i686-empeg-linux --target=i686-empeg-linux --host=i686-empeg-linux --prefix=/home/peter/gcc3temp --enable-languages=c,c++ Thread model: posix gcc version 3.4.0 ---- Compiler output: ---- vismgr.cpp: In member function `bool Visual::DrawsAllPixels() const': vismgr.cpp:30: internal compiler error: in instantiate_template, at cp/pt.c:8668 Please submit a full bug report, with preprocessed source if appropriate. ---- Preprocessed file: ---- # 1 "vismgr.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "vismgr.cpp" typedef long long LONGLONG; class ByteCount { public: typedef LONGLONG BaseType; BaseType m_bytes; template<typename T> inline ByteCount( T bytes ) : m_bytes( static_cast<BaseType>(bytes) ) { } friend bool operator!=( const ByteCount &x, const ByteCount &y ); }; class Visual { public: int m_render_type; bool m_fullscreen; enum { Render_transparent = 1, Render_opaque, Render_modify, Render_16bit}; bool DrawsAllPixels() const { return m_fullscreen && (m_render_type != Render_modify); } }; ----
Confirmed, reduced to: struct y { template<typename T> inline y( T bytes ) {} }; bool operator!=( const y &x, const y &y ); enum { Render_modify }; int m_render_type; void t() { (m_render_type != Render_modify); }
Indeed: --------------- struct S { template<typename T> inline S(T) {} }; bool operator!= (const S &x, const S &S); struct {} e; bool x= (e != e); --------------- g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc x.cc:7: internal compiler error: in instantiate_template, at cp/pt.c:8676 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc x.cc:6: error: non-local variable `<anonymous struct> e' uses anonymous type x.cc:7: internal compiler error: in instantiate_template, at cp/pt.c:8679 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
*** This bug has been marked as a duplicate of 15165 ***