public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/2700: Erroneous exception while constructing a derived class of ostream
@ 2001-04-30 12:36 matt_conway
  0 siblings, 0 replies; only message in thread
From: matt_conway @ 2001-04-30 12:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2700
>Category:       libstdc++
>Synopsis:       Erroneous exception while constructing a derived class of ostream
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 30 12:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     matt_conway@i2.com
>Release:        gcc 3.0 branch snapshot 4/24/2001
>Organization:
>Environment:
powerpc-ibm-aix4.3.3.0

as -v
GNU assembler version 2.9-aix43-000718 (powerpc-ibm-aix4.3.3.0) using BFD version 2.9-aix43-000718

>Description:
If I define a class which derives from ostream, I can construct and use it as an output stream without any problems.  However, if I also #include <fstream> in the same file, an exception gets thrown during the construction of my class.  The code given below demonstrates this.  The exception gets thrown on line 24 of /opt/gcc-3.0-010424/include/g++-v3/bits/basic_ios.tcc, during the call to use_facet<__numput_type>(_M_ios_locale) in basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)

>How-To-Repeat:
#include <iostream>

// Uncomment this and an exception gets thrown when mystream gets
// constructed
// #include <fstream>

using std::ostream;
using std::cout;
using std::endl;

class NDumpContext : public ostream
{

public:
	
	NDumpContext() : ostream(cout.rdbuf())
	{

	}

	virtual ~NDumpContext()
	{

	}

	NDumpContext(ostream& rhs)
		: ostream(rhs.rdbuf())
	{

	}

	virtual void Flush()
	{
		flush();
	}

};


int main()
{
	NDumpContext mystream(cout);
	cout << "Output to cout" << endl;
	mystream << "Output to mystream" << endl;
}

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-04-30 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-30 12:36 libstdc++/2700: Erroneous exception while constructing a derived class of ostream matt_conway

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).