public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: sebor@roguewave.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/10606: uncaught_exception() returns false too early
Date: Fri, 02 May 2003 21:26:00 -0000	[thread overview]
Message-ID: <20030502212520.26409.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2003-05-02 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02 21:26 sebor [this message]
2003-05-02 22:36 Martin Sebor

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=20030502212520.26409.qmail@sources.redhat.com \
    --to=sebor@roguewave.com \
    --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).