This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/2700: Erroneous exception while constructing a derived class of ostream
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/2700: Erroneous exception while constructing a derived class of ostream
- From: matt_conway at i2 dot com
- Date: 30 Apr 2001 19:31:08 -0000
- Reply-To: matt_conway at i2 dot com
>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: