
On Mon, Apr 30, 2012 at 11:14 AM, Phillip Hellewell
Good news. Luckily I was able to pinpoint the exact line of code causing VS to crash, and two different workarounds:
Crashes VS: return Foo_ptr(new Foo());
Workaround 1: return boost::shared_ptr<Foo>(new Foo());
Workaround 2: Foo_ptr ret(new Foo()); return ret;
Oops, I didn't even notice this but the return type on my function is Foo_const_ptr (boost::shared_ptr<const Foo>), not Foo_ptr. So this is the right fix: return Foo_const_ptr(new Foo()); I guess VS gets all flustered when: 1. Converting an r-value shared_ptr to a non-const object, to a shared_ptr to a const object, 2. when typedefs are involved, 3. in Debug x64 (other configurations weren't crashing). There must be some other factors too because when I wrote up a sample 10-line program to illustrate the problem, it didn't crash. Phillip