title: SegFault when using gmock
body: <p>I am using gmock 1.6 framework to code unit test.
  the unit tests exit and work fine on windows.</p>
  
  <p>The goal is to run them on linux.</p>
  
  <p>on Linux dev env:</p>
  
  <ul>
  <li><p>when I used eclipse CDT, the test work fine.</p></li>
  <li><p>but when I use command line command (cmake .. &amp;&amp; make), I get a segmentation fault while the execution.</p></li>
  </ul>
  
  <p>Software versions:</p>
  
  <ul>
  <li>GNU Make 4.1</li>
  <li>gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0</li>
  <li>cmake 3.10.2</li>
  </ul>
  
  <pre><code>class mockClass : puclic baseClass
  {
     .....
     MOCK_METHOD1(function, void(const std::shared_ptr&lt;mmmm&gt;));
     .....
  
  }
  
  TEST(testSerie1, test1)
  {
     mockClass attrb;
     ......
     EXPECT_CALL(attrb, function(_)).Times(AnyNumber()); // here code crahes
      ...
  }
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code>Thread 2 "m_thread" received signal SIGSEGV, Segmentation fault.
  [Switching to Thread  (LWP 20104)]
  0x0123 in testing::internal::FunctionMocker&lt;void (std::shared_ptr&lt;mmmmmmm&gt;)&gt;::Invoke(std::shared_ptr&lt;mmmmmmm&gt;) ()
  (gdb) 
  (gdb) 
  (gdb) backtrace 
  #0  ... in testing::internal::FunctionMocker&lt;void (std::shared_ptr&lt;mmmmmmm&gt;)&gt;::Invoke(std::shared_ptr&lt;mmmmmmm&gt;) ()
  #1  ... in MockIClass::function(std::shared_ptr&lt;mmmmmmm&gt;) ()
  .....
  .....
  .....
  #6  0x00007ffff72bb66f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  #7  0x00007ffff758e6db in start_thread (arg=0x7ffff664e700) at pthread_create.c:463
  #8  0x00007ffff6d1688f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  (gdb) 
  
  
  </code></pre>
  
  <p>Any idea please to avoid this segmentation fault ?</p>