template <class Foo> class bar {}; template <class Foo> class baz { int bar; friend class bar; }; Will cause ICE in pop_binding, at cp/decl.c:1187 Tested on 2.95.4, 2.96, and 3.2.2.
I can confirm this on 2.95.3, 3.0.4, 3.2.2, 3.2.3, 3.3.1 (20030616) and the mainline (20030626) but in 2.91.66, I do not get an ICE so this a regression wrt 2.91.66.
There are several other PRs for ICEs in pop_binding, see PR 157, PR 5402, PR 6289, PR 9777. Maybe they are connected. W.
The closest on this one looks like is bug 6289.
Subject: Re: [3.3/3.4 Regression] templates + friend + name conflict = ICE "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes: | There are several other PRs for ICEs in pop_binding, see PR 157, | PR 5402, PR 6289, PR 9777. Maybe they are connected. Indeed. That ICE is caused by the way we're handling binding contours. Hoepfully, they will be fixed as collateral benefits of the work on name lookup speed up. -- Gaby
Already fixed in the main trunk. So it's only a 3.3 regression now.
Since this is fixed on the mainline and it is a regression from 2.91.66 (released as egcs), I am closing this as fixed.