I had some code that worked before and it doesn't now. I have created minimal c++ project that can reproduce problem.
#include <iostream>
void PrintFooM();
class Foo
{
int m;
explicit Foo(int dummy) {}
Foo();
public:
static Foo& GetInstance()
{
static Foo f;
return f;
}
int GetM() const { return m; }
};
Foo::Foo()
: Foo(-1)
{
m = 3;
PrintFooM();
}
void PrintFooM()
{
std::cout << "M = " << Foo::GetInstance().GetM() << std::endl;
}
int main()
{
Foo::GetInstance();
return 0;
}
Code runs till PrintFooM function is called and its stuck there (like in some endless loop). Never prints anything in console.
I am using VS2017 community.