From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12841 invoked by alias); 2 May 2003 22:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12826 invoked by uid 71); 2 May 2003 22:36:01 -0000 Date: Fri, 02 May 2003 22:36:00 -0000 Message-ID: <20030502223601.12824.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Martin Sebor Subject: Re: c++/10606: uncaught_exception() returns false too early Reply-To: Martin Sebor X-SW-Source: 2003-05/txt/msg00161.txt.bz2 List-Id: The following reply was made to PR c++/10606; it has been noted by GNATS. From: Martin Sebor To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/10606: uncaught_exception() returns false too early Date: Fri, 02 May 2003 16:34:42 -0600 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10606 Here's another test case that also shows that the function fails to return true after the exception has been rethrown: $ cat t.cpp; g++ t.cpp && ./a.out #include #include void foo (const void*); int main () { #define SHOW(fun) \ printf ("%s(%d): %s: uncaught_exception() = %d\n", \ __FILE__, __LINE__, fun, std::uncaught_exception ()) static int n; struct S { int id; S (): id (n++) { printf ("S::S() [%d]: uncaught_exception() = %d\n", id, std::uncaught_exception ()); } S (const S &s): id (n++) { printf ("S::S(const S& [%d]) [%d]: uncaught_exception() = %d\n", s.id, id, std::uncaught_exception ()); } ~S () { printf ("S::~S() [%d]: uncaught_exception() = %d\n", id, std::uncaught_exception ()); } }; try { try { S s; SHOW ("throw"); throw s; } catch (S s) { SHOW ("catch"); foo (&s); throw; } } catch (S s) { SHOW ("catch"); foo (&s); } } void foo (const void*) { } S::S() [0]: uncaught_exception() = 0 t.cpp(32): throw: uncaught_exception() = 0 S::S(const S& [0]) [1]: uncaught_exception() = 0 S::~S() [0]: uncaught_exception() = 1 S::S(const S& [1]) [2]: uncaught_exception() = 0 t.cpp(36): catch: uncaught_exception() = 0 S::~S() [2]: uncaught_exception() = 0 S::S(const S& [1]) [3]: uncaught_exception() = 0 t.cpp(42): catch: uncaught_exception() = 0 S::~S() [3]: uncaught_exception() = 0 S::~S() [1]: uncaught_exception() = 0