title: C++ GoogleTest using fixture - function pointer definition not accessible
body: <p>I implemented a googletest, with fixture class <code>UnitTest_solver</code>. Implementation for the fixture is the following. It contains helper functions </p>
  
  <pre><code>class UnitTest_solver : public ::testing::Test
  {
  
  protected:
  
      static void SetUpTestCase()
      {
          // setup table with data
          m_col = 2; 
          m_row = 100;
          //  other things to initialize m_test_data 
      }
  
  
  
      static void TearDownTestCase()
      {
          for(int i = 0 ; i &lt; m_row ; i++)
              delete[] m_test_data[i];
          delete[] m_test_data;
      }
  
  
  
      static double chi_sqr(double* x)
      {
          if(m_col &lt; 2)
              return 0;
  
          double fx = 0;
  
          double * row_i = new double[m_col - 1];
  
          for(int i = 0 ; i &lt; m_row ; i++)
          {
              for(int j = 0 ; j &lt; m_col - 1 ; j++)
                  row_i[j] = m_test_data[i][j];
  
              fx += pow(m_test_data[i][0] - func_1(x, row_i, m_col - 1), 2.0); 
          }
      return fx;
      }
  
  
      static double func_1(double* x, double* dbl, int nb_param)
      {
          if(nb_param != 2)
              return 0;
  
          return x[0] * exp(-1 * x[1] * dbl[0]);
      }
  
      static double UnitTest_solver::functPtr( double * parameters, void * userinfo)
      {
          return  chi_sqr(parameters);
      }
  
      static ofstream thing;
      static double** m_test_data;
      static int m_col, m_row;
  
   };
  </code></pre>
  
  <p>Also, out of the fixture scope, i initialize static variables. Last is function pointer. is definition syntax ok ?</p>
  
  <pre><code>double** UnitTest_solver::m_test_data = 0;
  int UnitTest_solver::m_col = 0;
  int UnitTest_solver::m_row = 0;
  
  double (UnitTest_solver::*functPtr)(double * , void *) = 0;
  </code></pre>
  
  <p>then, i have a test case, with link to fixture UnitTest_solver. </p>
  
  <pre><code>TEST_F(UnitTest_solver, testFunc1)
  {
      Solver* solversqp = new Solver();
      solversqp-&gt;set_pointer_to_function(UnitTest_solver::functPtr, (void*)0);
      //...
  }
  </code></pre>
  
  <p>second line show compile time error with <code>UnitTest_solver::functPtr</code> : when mouse is over the error, info is 'function defined at line xxx is unacessible', with xxx pointing to <code>functPtr</code> definition inside the fixture.</p>
  
  <p>If i run the ggltest commenting the last line, <code>solversqp-&gt;set_pointer_to_function(UnitTest_solver::functPtr, (void*)0);</code>, test is finishing (if i put a trivial ASSERT, it is successful).</p>
  
  <p>Whats wrong with my function pointer definition.</p>