title: gtest capture result of EXPECT_NO_THROW statement
body: <p>Say I have a method which creates a non-trivially constructable object which is RVO'd back to the caller. For example</p>
  
  <pre><code>MyComplexClass value = deserialize();
  </code></pre>
  
  <p><code>deserialize</code> throws an exception on failure, so I want to do something like</p>
  
  <pre><code>EXPECT_NO_THROW(MyComplexClass value = deserialize());
  </code></pre>
  
  <p>but of course, value goes out of scope (since the macro introduces a try/catch block).
  And also </p>
  
  <pre><code>MyComplexClass value;
  EXPECT_NO_THROW(value = deserialize());
  </code></pre>
  
  <p>does not work since there is no default constructor (for example it is <code>= delete</code>).</p>
  
  <p>Any ideas on this? I could do something like</p>
  
  <pre><code>template&lt;typename TResult&gt;
  TResult return_assert_no_throw(std::function&lt;TResult()&gt; expression)
  {
      try
      {
          return expression();
      }
      catch (const std::exception &amp; ex)
      {
          ASSERT_TRUE(false);
      }
  }
  </code></pre>
  
  <p>but this seems a little hacky, and we lose information on the exception</p>