------- Comment #8 from fang at csl dot cornell dot edu 2010-08-18 22:05 ------- reduced test case (manually reduced after delta):
=========================================================== typedef long unsigned int size_t; template <class T> struct never_ptr { T* ptr; T* operator -> () const throw() { return ptr; } }; namespace HAC { template <class> class instance_collection_pool_bundle; template <class Tag> class footprint_base { typedef instance_collection_pool_bundle<Tag> collection_pool_bundle_type; protected: const never_ptr<collection_pool_bundle_type> collection_pool_bundle; }; struct process_tag; template <class Tag> class instance_collection; template <class> struct class_traits; template <class Tag> class instance_alias_info; } namespace std { template <class T> struct default_vector { typedef size_t type; }; } namespace HAC { class footprint : private footprint_base<process_tag> { void operator [] ( const size_t ) const; }; class physical_instance_collection; template <class, size_t> class instance_array; typedef instance_collection<process_tag> process_instance_collection; typedef instance_alias_info<process_tag> process_instance_alias_info; template <class> class general_collection_type_manager; template <> struct class_traits<process_tag> { typedef process_tag tag_type; typedef process_instance_alias_info instance_alias_info_type; typedef process_instance_collection instance_collection_generic_type; typedef physical_instance_collection instance_collection_parent_type; typedef general_collection_type_manager<tag_type> collection_type_manager_parent_type; }; class instance_collection_base { }; class physical_instance_collection : public instance_collection_base { }; template <class Tag> class collection_interface : public class_traits<Tag>::instance_collection_parent_type { }; template <class Tag> class instance_collection : public collection_interface<Tag>, public class_traits<Tag>::collection_type_manager_parent_type { public: typedef class_traits<Tag> traits_type; typedef typename traits_type::instance_alias_info_type instance_alias_info_type; typedef never_ptr<const instance_alias_info_type> const_instance_alias_info_ptr_type; }; template <class Tag> class general_collection_type_manager { }; template <class T> class instance_collection_pool_wrapper { public: typedef T collection_type; typedef typename collection_type::traits_type::tag_type tag_type; }; template <class Tag> struct instance_collection_pool_bundle : public instance_collection_pool_wrapper<instance_array<Tag, 0> > { void lookup_collection(void) const; }; template <class Tag, size_t D> class instance_array : public instance_collection<Tag> { public: typedef class_traits<Tag> traits_type; typedef typename traits_type::instance_collection_generic_type parent_type; typedef typename parent_type::const_instance_alias_info_ptr_type const_instance_alias_info_ptr_type; void get_all_aliases(typename std::default_vector<const_instance_alias_info_ptr_type>::type&) const; }; template <class Tag> class instance_array<Tag,0> : public instance_collection<Tag> { public: typedef class_traits<Tag> traits_type; typedef typename traits_type::instance_collection_generic_type parent_type; typedef typename parent_type::const_instance_alias_info_ptr_type const_instance_alias_info_ptr_type; void get_all_aliases(typename std::default_vector<const_instance_alias_info_ptr_type>::type&) const; }; void footprint::operator [] ( const size_t ) const { footprint_base<process_tag>::collection_pool_bundle->lookup_collection(); } } =========================================================== This should be a valid test case, passes g++-4.0.1. reducing script: #!/bin/sh -e # must be valid for g++-4.0.1! (powerpc-apple-darwin8) g++ -o footprint.o -c footprint.ii > /dev/null 2>&1 # then fail specifically with ICE g++-fsf-4.5 -o footprint.o -c footprint.ii > footprint.err 2>&1 || : grep -q "internal compiler error: in iterative_hash_template_arg, at cp/pt.c:1589" footprint.err keywords: ICE-on-valid-code -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45293