https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105752
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- And if you never instantiate the function, who cares? It doesn't actually access the private member, because you never call it. And if you try to, it doesn't compile.