------- Comment #5 from seongbae dot park at gmail dot com 2006-10-13 02:27 ------- A modified and valid case which doesn't cause ICE:
template <typename LHS, typename RHS>bool operator<( LHS lhs, RHS rhs ); struct ComputedAttribute { int descriptor(); }; class AttributeDescriptor {}; template <typename T, typename R> struct less_member_2_m { typedef R (T::* T_mem_ptr) (); T_mem_ptr mem_ptr; template <typename R_alt> bool operator()(R_alt & rhs ) { T a; return ( a.*mem_ptr )() < rhs ; } }; void computedAttribute( AttributeDescriptor & desc ) { less_member_2_m<ComputedAttribute, int> m; m.mem_ptr = &ComputedAttribute::descriptor; m(desc); } Change the operator() to: template <typename R_alt> bool operator()(R_alt & rhs ) { T a; return ( a.*mem_ptr ) < rhs ; } causes the ICE. # /home/spark/blds/trunk-work/bin/g++ -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: /home/spark/local/ws/trunk-work/configure --prefix=/home/spark/blds/trunk-work/ --disable-nls --disable-multilib -enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit -enable-c99 --enable-long-long --enable-shared --enable-languages=c,c++ Thread model: posix gcc version 4.2.0 20061006 (experimental) # /home/spark/blds/trunk-work/bin/g++ correct.cc -c # /home/spark/blds/trunk-work/bin/g++ incorrect.cc -c incorrect.cc: In member function 'bool less_member_2_m<T, R>::operator()(R_alt&) [with R_alt = AttributeDescriptor, T = ComputedAttribute, R = int]': incorrect.cc:28: instantiated from here incorrect.cc:19: internal compiler error: in gimplify_expr, at gimplify.c:5806 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. # Note that this is the same ICE I get from the attachment. -- seongbae dot park at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |seongbae dot park at gmail | |dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29225