Here is an MCVE:
#include <vector>
#include <thread>
class A{
std::vector<int> foo;
public:
A() {
std::thread t([this]() {
foo.push_back(1); // line steps successfully
}); // throws a runtime error when trying to step here
}
};
int main()
{
A a;
return 0;
}
In the debugger the line foo.push_back(1) runs and then it throws runtime error in the next line...