c++/7004: The program aborts if a function with exception-specification throws an exception that is not listed

vzw00011@nifty.ne.jp vzw00011@nifty.ne.jp
Wed Jun 12 06:30:00 GMT 2002


>Number:         7004
>Category:       c++
>Synopsis:       The program aborts if a function with exception-specification throws an exception that is not listed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 12 06:16:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     vzw00011@nifty.ne.jp
>Release:        3.1
>Organization:
>Environment:
Linux orange.fruits 2.4.19-pre3 #4 Fri Mar 15 21:50:55 JST 2002 i586 unknown
>Description:
When gcc compiles the code, gcc output no error or warning. but, the program abort.
I think that it is safe that gcc complains compile-error or warning.
>How-To-Repeat:
#include <exception>
#include <cstdio>

class MyException: public std::exception { };

void g() throw(MyException) { throw MyException(); }
void f() throw() { g(); }

int main() {
    try { f(); }
    catch (MyException& e) {
        printf("MyException thrown.\n");
    }
    catch (...) {
        printf("something thrown.\n");
    }
    return 0;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list