public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jwakely dot gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/41005] [C++0x] Unable to link fstream open and ctor with std::string argument.
Date: Mon, 10 Aug 2009 20:05:00 -0000	[thread overview]
Message-ID: <20090810200510.3894.qmail@sourceware.org> (raw)
In-Reply-To: <bug-41005-8829@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from jwakely dot gcc at gmail dot com  2009-08-10 20:05 -------
(In reply to comment #5)
> Instead of instantiating that code in every object a single explicit
> instantiation is provided in libstdc++.so, that's the purpose of
> src/fstream-inst.cc

... but in this case it fails to provide an explicit instantiation of the new
C++0x members because src/fstream-inst.cc is not compiled with -std=c++0x or
-std=gnu++0x

So the library tells the compiler not to instantiate the templates in your
code, promising to provide explicit instantiations, and then fails to provide
the explicit instantiations. So the workaround I gave in comment #3 provides
them in your program.  Another workaround would be to compile with
-D_GLIBCXX_EXTERN_TEMPLATE=0, which disables the extern template feature,
causing the compiler to implicitly instantiate the templates in every file that
needs them, and then rely on the linker to merge the duplicate definitions.

But the right fix is just to ensure src/fstream-inst.cc is compiled in C++0x
mode, so that the instantiations are present in libstdc++.so and you don't need
any workaround.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41005


  parent reply	other threads:[~2009-08-10 20:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-08  2:09 [Bug libstdc++/41005] New: " 3dw4rd at verizon dot net
2009-08-10 12:26 ` [Bug libstdc++/41005] " jwakely dot gcc at gmail dot com
2009-08-10 13:17 ` jwakely dot gcc at gmail dot com
2009-08-10 15:09 ` [Bug libstdc++/41005] [C++0x] " redi at gcc dot gnu dot org
2009-08-10 19:35 ` 3dw4rd at verizon dot net
2009-08-10 19:39 ` jwakely dot gcc at gmail dot com
2009-08-10 20:05 ` jwakely dot gcc at gmail dot com [this message]
2009-08-11 23:02 ` jwakely dot gcc at gmail dot com
2009-08-12  8:56 ` jwakely dot gcc at gmail dot com
2009-08-12  8:57 ` redi at gcc dot gnu dot org
2009-08-26 19:03 ` redi at gcc dot gnu dot org
2009-08-26 19:04 ` redi at gcc dot gnu dot org
2009-08-26 19:16 ` redi at gcc dot gnu dot org
2009-08-26 22:55 ` paolo dot carlini at oracle dot com

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=20090810200510.3894.qmail@sourceware.org \
    --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).