public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7471: exception specification violation error when using function try block
@ 2002-08-02  7:36 aeonflux
  0 siblings, 0 replies; 2+ messages in thread
From: aeonflux @ 2002-08-02  7:36 UTC (permalink / raw)
  To: gcc-gnats


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/7471: exception specification violation error when using function try block
@ 2002-09-13 16:33 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-09-13 16:33 UTC (permalink / raw)
  To: aeonflux, gcc-bugs, gcc-prs, nobody

Synopsis: exception specification violation error when using function try block

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Sep 13 16:33:21 2002
State-Changed-Why:
    fixed in 3.2

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7471


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-13 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-02  7:36 c++/7471: exception specification violation error when using function try block aeonflux
2002-09-13 16:33 nathan

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).