title: Can Google Mock a method with a smart pointer return type?
body: <p>I have a factory that returns a smart pointer. Regardless of what smart pointer I use, I can't get Google Mock to mock the factory method.</p>
  
  <p>The mock object is the implementation of a pure abstract interface where all methods are virtual. I have a prototype:</p>
  
  <pre><code>MOCK_METHOD0(Create, std::unique_ptr&lt;IMyObjectThing&gt;());
  </code></pre>
  
  <p>And I get:</p>
  
  <pre><code>"...gmock/gmock-spec-builders.h(1314): error C2248: 'std::unique_ptr&lt;_Ty&gt;::unique_ptr' : cannot access private member declared in class 'std::unique_ptr&lt;_Ty&gt;'"
  </code></pre>
  
  <p>The type pointed to in the smart pointer is defined.</p>
  
  <p>And I get it's trying to access one of the constructors declared private, but I don't understand why. When this was an std::auto_ptr, the error said there was no copy constructor, which confuses me.</p>
  
  <p>Anyway, is there a way to Mock a method that returns a smart pointer? Or is there a better way to build a factory? Is my only resolve to return a raw pointer (blech...)?</p>
  
  <p>My environment is Visual Studio 2010 Ultimate and Windows 7. I'm not using CLI.</p>