dimanche 29 janvier 2017

c++ Visual Studio freaks out when exception thrown

Trying to catch an exception in Visual Studio and realized it was not unwinding the call stack. Narrowed it down to this example and yet it still throws the exception but get's caught by something other than me. Any ideas what I'm missing here?

#include <stdexcept>
#include <iostream>
int main(){
  try { throw std::exception("test"); }
  catch (...) { std::cout << "something happened"; }
}

visual studio is kind enough to alert me that an exception has been thrown.

After looking over the example and placing breakpoints, I've discovered that VS seems adamant that my catch block is unreachable code. This leaves me further confused and still no answer in sight.

Aucun commentaire:

Enregistrer un commentaire