[Bug c++/61214] [4.9/4.10 regression]=?UTF-8?Q?=C2=A0Weird=20interaction=20between=20=2Dfvisibility=2Dinlines=2Dhidden?=, inline virtuals and devirtualization

delroth@dolphin-emu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 13 23:49:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61214

--- Comment #3 from Pierre Bourdon <delroth@dolphin-emu.org> ---
I'm more wondering why Foo::clone is not being instantiated by the code that
calls it.

Does C++ specify that virtual inline functions are guaranteed to be
instantiated in the compilation unit that contains the vtable? It looks like
this is the assumption made by GCC at the moment.

FYI, a more "real" testcase: if you build wxWidgets 3.0 with
-fvisibility=hidden -fvisibility-inlines-hidden (the default, afaict), the
following will work on gcc 4.8 but not 4.9:

$ cat >testcase.cpp <<EOF
#include <wx/event.h>

int main()
{
wxEvent* evt = new wxNotifyEvent();
evt->Clone();
return 0;
}
EOF
$ g++ -std=c++11 -O3 $(wx-config --cxxflags --libs) testcase.cpp



More information about the Gcc-bugs mailing list