The previous exception for smart pointers was too general
I suspect that this object B does not necessarily has local storage here. Due to copy elision it may end up pretty much anywhere. The smart pointer is on the stack though. When exactly is the escape supposed to happen here? Do we have a more simple test? :)
Also does this need to be a method?