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

            Bug ID: 57720
           Summary: [C++11]Crash when Delegating Constructors throw
                    exceptions
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liweifriends at gmail dot com

System type: 
    windows server 2012 + mingw-build (64 bit)

source code:

#include <iostream>
#include <stdexcept>
using namespace std;

class DCExcept
{
public:
    DCExcept(double d)
        try : DCExcept()
        {
            cout<<"Run the body."<<endl;
        }
        catch(...)
        {
            cout<<"Caught exception."<<endl;
        }

private:
    DCExcept()
    {
        throw runtime_error("error");
    }
};

int main()
{
    DCExcept a(1.2);
    return 0;
}


build cmd:
    g++.exe -Wall -fexceptions  -g  -std=c++11    -c d:\CPPLearn\main.cpp -o
obj\Debug\main.o
    g++.exe  -o bin\Debug\CPPLearn.exe obj\Debug\main.o 

run cmd: 
    CPPLearn.exe

compiler output:

Caught exception.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Reply via email to