https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62207
pipcet at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pipcet at gmail dot com --- Comment #4 from pipcet at gmail dot com --- I believe this invalid code triggers the same bug, and might be easier to analyze: extern int fn(); template<class F> class X { public: template<F f> class Y {}; template<F f> void y() {} X(F f) { Y<f> y; y.value(); } }; int main() { const X<decltype(&fn)> x(fn); } In both cases, an identifier is used twice ("y" here, "ptr" in the original example), and renaming one instance to avoid the name clash avoids the ICE.