An uncaught C++ exception will terminate the program. Often with a stack trace but that is up to the implementation.
So no, in your example bar()
will never be called.
Update: In some situations the optimizer could inline both functions and move some code from bar
to the top of main
. You would only see this in a debugger though, because anything with side effects cannot be moved like that.