From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29591 invoked by alias); 5 Feb 2004 10:54:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 29580 invoked by uid 48); 5 Feb 2004 10:54:33 -0000 Date: Thu, 05 Feb 2004 10:54:00 -0000 From: "hubert dot schmid at stud dot uka dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20040205105427.14026.hubert.schmid@stud.uka.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/14026] New: std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception) X-Bugzilla-Reason: CC X-SW-Source: 2004-02/txt/msg00610.txt.bz2 List-Id: The following code shows the problem: #include int main() { try { throw 1; } catch (...) { try { throw; } catch (...) { std::cout << std::uncaught_exception() << std::endl; } } std::cout << std::uncaught_exception() << std::endl; } The program prints: 1 1 The expected output is: 0 0 Some detail: std::uncaught_exception() uses a variable (uncaughtExceptions), that counts the number of uncaught exceptions. The value of this variable is -1 at the two print statements. I guess, this variable is incremented each time an exception is thrown and decremented each time an exception is caught. I also guess, that in the above program, the variable is possible not incremented at the rethrow statement. -- Summary: std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception) Product: gcc Version: 3.2.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hubert dot schmid at stud dot uka dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-pc-linux-gnu GCC host triplet: i386-pc-linux-gnu GCC target triplet: i386-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14026