Why does this program
#include <clang-c/Index.h>
#include <exception>
#include <iostream>
int main() {
try {
throw std::exception("threw");
} catch (const std::exception& e) {
std::cout << e.what() << "\n";
}
CXIndex idx = clang_createIndex(0, 0);
clang_disposeIndex(idx);
return 0;
}
behave as expected, but this one
#include <clang-c/Index.h>
#include <exception>
#include <iostream>
int main() {
CXIndex idx = clang_createIndex(0, 0);
clang_disposeIndex(idx);
try {
throw std::exception("threw");
} catch (const std::exception& e) {
std::cout << e.what() << "\n";
}
return 0;
}
crashes?
More generally, what could a function do that causes subsequent exceptions to not get caught?
Using: visual c++ 10.0 (tried the different /EH flags), clang 3.4 (built with the same)