title: Non-static data members class deduction
body: <p>I'm trying to solve type deduction issue.</p>
  <p>Here's the demo code, that uses function overloading to define, whether the passed variable is int or double</p>
  <pre class="lang-cpp prettyprint-override"><code>
  std::string tcast( const double &amp;x){ return &quot;Floating Point&quot;;};
  std::string tcast( const int    &amp;x){ return &quot;Integer&quot;;};
  
  int main(){
      double dA;
      int    iB;
      std::cout &lt;&lt; &quot;Access to variable type \n&quot;;
      std::cout &lt;&lt; &quot;dA : &quot;&lt;&lt; tcast( dA )&lt;&lt; std::endl;
      std::cout &lt;&lt; &quot;iB : &quot;&lt;&lt; tcast( iB )&lt;&lt; std::endl;
  }
  </code></pre>
  <pre><code>Access to variable type 
  dA : Floating Point
  iB : Integer
  </code></pre>
  <p>But this function doesn't work for non-static class members:</p>
  <pre class="lang-cpp prettyprint-override"><code>struct Foo{
      double dA;
      int    iB;
  };
  
  int main(){
  
      std::cout &lt;&lt; &quot;Member dA : &quot;&lt;&lt; tprint( &amp;Foo::dA )&lt;&lt; std::endl;
      std::cout &lt;&lt; &quot;Member iB : &quot;&lt;&lt; tprint( &amp;Foo::iB )&lt;&lt; std::endl;
  
  }
  
  </code></pre>
  <p>GCC compilation error:</p>
  <pre><code>main.cpp: In function ‘int main(int, char**)’:
  main.cpp:111:44: error: no matching function for call to ‘tcast(double Foo::*)’
    111 |     std::cout &lt;&lt; &quot;dA : &quot;&lt;&lt; tcast( &amp;Foo::dA )&lt;&lt; std::endl;
        |                                            ^
  main.cpp:96:13: note: candidate: ‘std::string tcast(const double&amp;)’
     96 | std::string tcast( const double &amp;x){ return &quot;Floating Point&quot;;};
        |             ^~~~~
  main.cpp:96:34: note:   no known conversion for argument 1 from ‘double Foo::*’ to ‘const double&amp;’
     96 | std::string tcast( const double &amp;x){ return &quot;Floating Point&quot;;};
        |                    ~~~~~~~~~~~~~~^
  main.cpp:97:13: note: candidate: ‘std::string tcast(const int&amp;)’
     97 | std::string tcast( const int    &amp;x){ return &quot;Integer&quot;;};
        |             ^~~~~
  main.cpp:97:34: note:   no known conversion for argument 1 from ‘double Foo::*’ to ‘const int&amp;’
     97 | std::string tcast( const int    &amp;x){ return &quot;Integer&quot;;};
        |                    ~~~~~~~~~~~~~~^
  </code></pre>
  <p>But the following code compiles :</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename T&gt;
  std::string tprint( const T    &amp;x){ return typeid(x).name();};
  ...
  std::cout &lt;&lt; &quot;dA : &quot;&lt;&lt; tprint( dA )&lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;iB : &quot;&lt;&lt; tprint( iB )&lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;Member dA : &quot;&lt;&lt; tprint( &amp;Foo::dA )&lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;Member iB : &quot;&lt;&lt; tprint( &amp;Foo::iB )&lt;&lt; std::endl;
  </code></pre>
  <p>And so it's visible for compiler that dA has type double and iB int</p>
  <pre><code>dA : d
  iB : i
  Member dA : M3Food  // ends in d
  Member iB : M3Fooi  // ends in i
  </code></pre>
  <p>So what should be the right way to deduct the type of the non-static data member?</p>