Bug 32119 - g++ does not check exception-specifications
Summary: g++ does not check exception-specifications
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 8.0
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords: FutureFeature
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-03-18 07:03 UTC by Wagner T. Correa
Modified: 2007-04-18 16:32 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-07 12:28:44 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Wagner T. Correa 2001-03-18 07:03:55 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.16-22smp i686)


When a function specifies the exceptions that it may throw, the compiler
can check if a caller is either handling the exceptions or throwing them
too. g++ does not check that.

Reproducible: Always
Steps to Reproduce:
#include <exception>

void foo() throw (exception)
{
        throw exception();
}

int main()
{
        foo(); // should get a warning here
        return 0;
}


Actual Results:  The program above compiles without any warning and
dumps core when run.


Expected Results:  The program should still compile, but g++ should give a
warning that the exception is not being handled, so the programmer could
create a try block and handle it more gracefully than simply dumping core.

Comment 1 Omnifarious 2001-07-02 20:23:10 UTC
Also:

void foo() throw(int)
{
    throw "Fred";
}

should also generate a warning.


Comment 2 Jakub Jelinek 2004-10-07 12:28:44 UTC
This is an enhancement request that should have been filed upstream.
See http://gcc.gnu.org/bugzilla/


Note You need to log in before you can comment on or make changes to this bug.