public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: peturr02@ru.is
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/10132: filebuf destructor throws exceptions
Date: Tue, 18 Mar 2003 12:16:00 -0000	[thread overview]
Message-ID: <20030318120729.2708.qmail@sources.redhat.com> (raw)


>Number:         10132
>Category:       libstdc++
>Synopsis:       filebuf destructor throws exceptions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 18 12:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc-3.2.2
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
The destructor of basic_filebuf calls basic_filebuf::close() without handling exceptions thrown by that function (close() calls use_facet and codecvt::out(), both of which may throw).
>How-To-Repeat:
See attachment.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="dtorbug.cc"
Content-Disposition: inline; filename="dtorbug.cc"

#include <fstream>
#include <locale>
#include <cwchar>

#undef NDEBUG
#include <cassert>

class MyEx
{
};

class Cvt : public std::codecvt<wchar_t, char, std::mbstate_t>
{
protected:
	virtual std::codecvt_base::result
	do_out(std::mbstate_t&, const wchar_t*, const wchar_t*,
	       const wchar_t*&, char*, char*, char*&) const
		{
			throw MyEx();
		}
};

int main()
{
	using namespace std;

	locale loc;
	loc = locale(loc, new Cvt);
	
	wfilebuf* fb = new wfilebuf;
	fb->pubimbue(loc);
	fb->open("tmp", ios_base::out);
	fb->sputc(L'a');
	
	try
	{
		delete fb;
	}
	catch (...)
	{
		assert(false);
	}

	return 0;
}


             reply	other threads:[~2003-03-18 12:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-18 12:16 peturr02 [this message]
2003-04-22  1:08 bkoz
2003-04-23  3:47 bkoz
2003-04-23  8:56 Pétur Runólfsson
2003-04-24  6:06 Benjamin Kosnik
2003-04-24  6:06 Benjamin Kosnik
2003-04-24 18:56 Pétur Runólfsson
2003-04-24 22:06 Benjamin Kosnik
2003-04-24 22:26 Benjamin Kosnik
2003-04-25  0:56 Benjamin Kosnik
2003-04-25 21:46 Pétur Runólfsson
2003-04-25 21:56 Pétur Runólfsson
2003-04-28 16:00 bkoz

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=20030318120729.2708.qmail@sources.redhat.com \
    --to=peturr02@ru.is \
    --cc=gcc-gnats@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).