c++/10606: uncaught_exception() returns false too early
sebor@roguewave.com
sebor@roguewave.com
Fri May 2 21:31:00 GMT 2003
>Number: 10606
>Category: c++
>Synopsis: uncaught_exception() returns false too early
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 02 21:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: sebor@roguewave.com
>Release: 3.2
>Organization:
>Environment:
>Description:
The program below shows that the gcc implementation of uncaught_exception() violates 15.5.3, p1. Specifically, the function is required to return true "until completing the initialization of the exception-declaration in the matching handler" which the gcc impletation fails to do (the output line marked <<<).
Martin
>How-To-Repeat:
$ cat t.cpp; g++ t.cpp && ./a.out
#include <stdio.h>
#include <exception>
int main ()
{
#define SHOW(fun) \
printf ("%s(%d): %s: uncaught_exception() = %d\n", \
__FILE__, __LINE__, fun, std::uncaught_exception ())
struct S {
S () { SHOW ("S::S()"); }
S (const S &s) { SHOW ("S::S(const S&)"); }
~S () { SHOW ("S::~S()"); }
};
try {
S s;
throw s;
}
catch (S s) {
SHOW ("catch");
}
}
t.cpp(11): S::S(): uncaught_exception() = 0
t.cpp(12): S::S(const S&): uncaught_exception() = 0
t.cpp(13): S::~S(): uncaught_exception() = 1
t.cpp(12): S::S(const S&): uncaught_exception() = 0 <<<
t.cpp(21): catch: uncaught_exception() = 0
t.cpp(13): S::~S(): uncaught_exception() = 0
t.cpp(13): S::~S(): uncaught_exception() = 0
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list