http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46557
Summary: [4.6 Regression] ICE in cgraph_will_be_removed_from_program_if_no_direct_calls , at cgraph.c:2820 Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org CC: hubi...@gcc.gnu.org > ./cc1plus -quiet cppduchain.3.1.3.3.ii -O2 -std=c++0x cppduchain.3.1.3.3.ii:39:9: internal compiler error: in cgraph_will_be_removed_from_program_if_no_direct_calls, at cgraph.c:2820 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. reduced testcase: template< class T > class TypePtr { public: T* operator->(); template<class U> TypePtr<U> cast(U * = 0) const; }; class AbstractType { public: typedef TypePtr<AbstractType> Ptr; }; class TypeExchanger { public: virtual ~TypeExchanger() { } }; class TypeAliasType { public: typedef TypePtr<TypeAliasType> Ptr; AbstractType::Ptr type() const; }; AbstractType::Ptr shortenTypeForViewing(AbstractType::Ptr type) { struct ShortenAliasExchanger : public TypeExchanger { virtual AbstractType::Ptr exchange(const AbstractType::Ptr& type) { TypeAliasType::Ptr alias = type.cast<TypeAliasType>(); AbstractType::Ptr shortenedTarget = exchange(alias->type()); } }; ShortenAliasExchanger exchanger; type = exchanger.exchange(type); } probably related to both PR46535 and PR46523 (all from the same original testcase)