c++gcc

"throw" crashes program, but compiles fine


My program compiles fine, but crashes everytime throw (not inside of a try...catch block) is called.

Here are the command like arguments used for all files in the project:

mingw32-g++.exe -fexceptions -DWIN32 -D_WINDOWS -D_MBCS -DNO_SOCKLEN_T -DDONTUSEMEMMANAGER -Wall -g -W -fexceptions -DDEBUG

(I know that Wall makes W unnecessary and that I have -fexceptions in there twice.)

edit: I know that the there's actually nothing wrong with that behaviour. the thing is, it used to work aka the program wouldn't crash. but some days ago I made a change to some of the files , compiled again and all of a sudden it crashed


Solution

  • Well, this is the expected behavior. The standard says [except.handle]:

    If no matching handler is found, the function std::terminate() is called; [...]