public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jlink at drw dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67632] New: explicit instantiation omits copy constructor and others
Date: Fri, 18 Sep 2015 20:54:00 -0000 [thread overview]
Message-ID: <bug-67632-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67632
Bug ID: 67632
Summary: explicit instantiation omits copy constructor and
others
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlink at drw dot com
Target Milestone: ---
When I compile the follow test case with g++ -std=c++11 -c, and view the output
with nm, it shows that the std::unordered_map copy constructor is never
emitted:
% cat t.cc
#include <unordered_map>
template class std::unordered_map<int, int>;
% g++ -std=c++11 -c t.cc
%
If I compile the following and link it with the above, I'll get the undefined
reference:
% cat x.cc
#include <unordered_map>
extern template class std::unordered_map<int, int>;
std::unordered_map<int, int> copy(
const std::unordered_map<int, int> & a) { return a; }
main() {}
% g++ -std=c++11 t.o x.cc
/tmp/cc0dF94P.o: In function `copy(std::unordered_map<int, int, std::hash<int>,
std::equal_to<int>, std::allocator<std::pair<int const, int> > > const&)':
x.cc:(.text+0x1f): undefined reference to `std::unordered_map<int, int,
std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> >
>::unordered_map(std::unordered_map<int, int, std::hash<int>,
std::equal_to<int>, std::allocator<std::pair<int const, int> > > const&)'
collect2: error: ld returned 1 exit status
This seems like a clear bug, right? Either the explicit instantiation should
emit everything, or the use of extern template should know what still needs to
be emitted locally.
next reply other threads:[~2015-09-18 20:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 20:54 jlink at drw dot com [this message]
2015-09-18 22:04 ` [Bug c++/67632] " trippels at gcc dot gnu.org
2015-09-18 22:44 ` jlink at drw dot com
2015-09-19 9:20 ` [Bug libstdc++/67632] " trippels at gcc dot gnu.org
2015-09-19 10:20 ` redi at gcc dot gnu.org
2015-09-19 10:24 ` trippels at gcc dot gnu.org
2015-09-19 10:31 ` redi at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-67632-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).