https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119614
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly further simplified:
struct S {} a;
char *foo ();
int e, g;
void bar (int);
void freddy (S);
struct U {
void baz ();
template <int>
void
baz (int)
{
static const char *(*f) () { qux<true> };
f ();
}
template <bool>
static const char *qux ();
};
__attribute__((noinline)) char *
corge ()
{
bar (1);
return 0;
}
void
U::baz ()
{
baz<1> (1);
}
template <bool>
const char *
U::qux ()
{
if (e == 1)
{
S b = a;
freddy (b);
if (g)
return nullptr;
[[gnu::musttail]] return corge ();
}
return foo ();
}