https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113976
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Testcase showing that it is just this case of implicit instantiation followed by explicit that is problematic: int foo () { return 42; } template <int N> const int a = foo (); const int *b = &a <0>; template <int N> const int c = foo (); template const int c <0>; template <int N> const int d = foo (); const int *e = &d <0>; template const int d <0>; template <int N> const int f = foo (); template const int f <0>; const int *g = &f <0>; int main () {}