https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80469
--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Ubikovich from comment #5)
> (In reply to Markus Trippelsdorf from comment #4)
> > (In reply to Ubikovich from comment #3)
> > > >> You need to provide the definition of dothis() somewhere.
> > >
> > > There is the definition:
> > >
> > > // subimpl.cpp
> > > #include "subimpl.h"
> > > void A::dothis() {}
> >
> > Yeah, put "__attribute__ ((visibility("default")))" above it and you're
> > done.
>
> Why if move implement of A::a() to subimpl.cpp it not reproduced?
Because then the compiler sees the definition of A::dothis in the same TU.
And it doesn't generate a undefined symbol for main.cpp.
But this is not the right place to discuss this.
Read https://www.akkadia.org/drepper/dsohowto.pdf if you need more info.