This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13944] New: exception in constructor of a class to be thrown is not caught


[forwarded from http://bugs.debian.org/228099]

Running the following code compiled with 'g++ 3.3.3 testex.cc' results in a
SIGABRT. The bug submitter sees no reason why this should happen. With g++ 3.2.3
it works, i.e. the exception 1 in A() is caught by the try-block.


# 1 "testex.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "testex.cc"
class A
{
    public:
        A() {throw(1);}
};

int main(int argc, char *argv)
{
    try
    {
        throw A();
    }
    catch(...)
    {
    }
}

gcc-3.4 (CVS 20040113) and 3.5 (CVS 20040113 tree-ssa) are more verbose:

$ g++-3.4 bug-228099.cc && ./a.out 
terminate called after throwing an instance of 'i'
Aborted

$ g++-3.5 bug-228099.cc && ./a.out 
terminate called without an active exception
Aborted

-- 
           Summary: exception in constructor of a class to be thrown is not
                    caught
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13944


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]