Bug 16715 - std::basic_iostream is instantiated when used, even though instantiations are already contained in libstdc++
Summary: std::basic_iostream is instantiated when used, even though instantiations are...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.4.1
: P2 minor
Target Milestone: 3.4.3
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-26 13:36 UTC by Simon Richter
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Richter 2004-07-26 13:36:59 UTC
Hi,

I'm writing a library that extends the stream classes. Since the standard
instantiations of the iostream templates are already contained in libstdc++,
I would expect these not to be incorporated into my library (i.e. marked
"extern" in some header file). This is true for std::istream and std::ostream
(and their wide counterparts), but not for std::iostream, which is
instantiated and placed in my library.

I believe that std::iostream and std::wiostream should be marked "extern".

   Simon
Comment 1 Andrew Pinski 2004-07-26 14:44:02 UTC
Note extern is a GCC extension.
Also note that this is just size saving and nothing more.
But I will let the libstdc++ people say if this is a good idea or not.
Comment 2 Benjamin Kosnik 2004-09-02 18:37:04 UTC
It looks like io-inst.cc does explicitly instatiate std::iostream for char,
wchar_t. 

So, they should have extern bits in the headers as well.

Fixed, thanks for reporting this.

-benjamin
Comment 3 CVS Commits 2004-09-02 18:58:41 UTC
Subject: Bug 16715

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bkoz@gcc.gnu.org	2004-09-02 18:58:34

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: istream.tcc 

Log message:
	2004-09-02  Benjamin Kosnik  <bkoz@redhat.com>
	Simon Richter  <Simon.Richter@hogyros.de>
	
	PR libstdc++/16715
	* include/bits/istream.tcc: Add extern template for iostream
	char and wchar_t instantiations.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2652&r2=1.2653
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/istream.tcc.diff?cvsroot=gcc&r1=1.71&r2=1.72

Comment 4 CVS Commits 2004-09-08 13:37:06 UTC
Subject: Bug 16715

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	bkoz@gcc.gnu.org	2004-09-08 13:37:04

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: istream.tcc 

Log message:
	2004-09-08  Benjamin Kosnik  <bkoz@redhat.com>
	Simon Richter  <Simon.Richter@hogyros.de>
	
	PR libstdc++/16715
	* include/bits/istream.tcc: Add extern template for iostream
	char and wchar_t instantiations.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.171&r2=1.2224.2.172
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/istream.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.60.4.5&r2=1.60.4.6

Comment 5 Andrew Pinski 2004-09-09 03:46:50 UTC
Fixed for 3.4.3.