From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23192 invoked by alias); 2 Aug 2002 14:36:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23171 invoked by uid 71); 2 Aug 2002 14:36:01 -0000 Resent-Date: 2 Aug 2002 14:36:01 -0000 Resent-Message-ID: <20020802143601.23170.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, aeonflux@roadfly.com Received: (qmail 17514 invoked by uid 61); 2 Aug 2002 14:26:16 -0000 Message-Id: <20020802142616.17513.qmail@sources.redhat.com> Date: Fri, 02 Aug 2002 07:36:00 -0000 From: aeonflux@roadfly.com Reply-To: aeonflux@roadfly.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/7471: exception specification violation error when using function try block X-SW-Source: 2002-08/txt/msg00025.txt.bz2 List-Id: >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 >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 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: