public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: aeonflux@roadfly.com To: gcc-gnats@gcc.gnu.org Subject: c++/7471: exception specification violation error when using function try block Date: Fri, 02 Aug 2002 07:36:00 -0000 [thread overview] Message-ID: <20020802142616.17513.qmail@sources.redhat.com> (raw) >Number: 7471 >Category: c++ >Synopsis: exception specification violation error when using function try block >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Aug 02 07:36:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Paul Braman <aeonflux@roadfly.com> >Release: 2.95/3.x >Organization: >Environment: Red Hat Linux 7.3, plus outside verification >Description: An exception that is thrown from a function try block may violate an exception specification before it can be remapped inside the catch block. If the try and catch blocks are scoped within the function, the code will not violate the exception specification (the correct behavior). >How-To-Repeat: The following code demonstrates the problem. 01: #include <iostream> 02: namespace { 03: void something () throw (long) 04: try { 05: throw int (1); // vioates ES 06: } catch (int) { 07: throw long (1); // remaps to non-violation 08: } 09: } 10: int main () 11: try { 12: something (); 13: return 0; 14: } catch (long) { 15: std::cout << "caught" << std::endl; 16: return 1; 17: } This code should execute and display "caught" to standard output. However, the code will crash according to the exception specification violation rules. By making the following changes to the program... 03: void something () throw (long) { 08: } } ...(note the extra level of scope), the compiled program will execute normally. >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-08-02 14:36 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-08-02 7:36 aeonflux [this message] 2002-09-13 16:33 nathan
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=20020802142616.17513.qmail@sources.redhat.com \ --to=aeonflux@roadfly.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: linkBe 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).