This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/64275] Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule"
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 30 Jan 2015 11:23:50 +0000
- Subject: [Bug libstdc++/64275] Warnings when linking GCC go1: "(virtual table of) type 'struct X' violates one definition rule"
- Auto-submitted: auto-generated
- References: <bug-64275-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64275
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The simplest way to solve this might be to replace the extern declarations in
ios_init.cc such as:
extern stdio_sync_filebuf<char> buf_cout_sync;
with a pointer:
extern stdio_sync_filebuf<char>* buf_cout_sync_p;
then in globals_io.cc do:
stdio_sync_filebuf<char>* buf_cout_sync_p =
reintepret_cast<stdio_sync_filebuf<char>*>(buf_cout_sync);
That way we have an explicit cast rather than just relying on the linker
finding the symbol.