https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80469
Bug ID: 80469 Summary: Undefined symbol for abstract class impl with -fvisibility=hidden Product: gcc Version: 5.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: theubik at mail dot ru Target Milestone: --- Created attachment 41231 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41231&action=edit example When building with gcc 5.4 two libs (used option -fvisibility=hidden), first has undefined symbol. With gcc 4.9 (4.9.3) not reproduced. >> # uname -a >> Linux vbox-ubuntu16 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC >> 2017 x86_64 x86_64 x86_64 GNU/Linux >> #gcc --version >> gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 Example: // main.cpp #include "subimpl.h" class XXX { IA* p; public: ~XXX() { p->a(); } }; XXX xxx; // subimpl.h #pragma once struct IA { virtual void a() = 0; }; class A : public IA { public: void dothis(); void a() { dothis(); } }; // subimpl.cpp #include "subimpl.h" void A::dothis() {} >> # ldd -r libexperiments.so | grep undefined >> undefined symbol: _ZN1A6dothisEv (./libexperiments.so)