$ cat >driver.cxx template <typename X> struct Ref { };
namespace Bits { template <typename X> X& x (); } template <typename X, typename Y> typeof (Bits::x<X> () + Bits::x<Y> ()) operator+ (Ref<X> const& x, Ref<Y> const& y) { return X (0) + Y (0); } int main () { Ref<int> ra; Ref<int> rb; int j = ra + rb; } $ g++-4.0 --version g++-4.0 (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) $ g++-4.0 driver.cxx driver.cxx: In function '__typeof__ ((x<X>() + x<Y>())) operator+(const Ref<X>&, const Ref<Y>&) [with X = int, Y = int]': driver.cxx:17: internal compiler error: in write_type, at cp/mangle.c:1645 -- Summary: internal compiler error: in write_type, at cp/mangle.c:1645 Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: boris at kolpackov dot net GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25544