If internally all floats are treated as double, then if I throw exception in
the below code as double(which is 100.0) and catch as float why the program
terminates, rather the catch of float should also be elevated to double type in
the absence of explicit catch of double.

        try{
                cout<<"Inside the try block"<<endl;
                throw 100.0;
                cout<<"This will not be executed\n";
        }catch(float x)
        {
                cout<<"Inside the catch block"<<endl;
                cout<<"Exception is "<<x<<endl;
        }

//The program would terminate rather than catching exception


-- 
           Summary: Double exception not caught if only float is present in
                    exception
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: korikov at hotmail dot com


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

Reply via email to