title: Why does my attempt at detecting static members using SFINAE appear not to work?
body: <p>I've just made a template to detect if a data member of a class is static defined or not. The accessibility of the member isn't what it should be concerned about(Assuming the member is always accessible by the template) in this post. Here is the code with any symbols for testing:</p>
  
  <pre><code>#include &lt;conio.h&gt;
  //#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  
  struct A1
  {
      int a;
  };
  
  struct A2
  {
      static int a;
  };
  
  int A2::a{};
  
  template &lt; class My_Type &gt;
  struct TestStatic
  {
      template &lt; typename raw_ty &gt; static char fTest(...);
  
      template &lt; typename class_ty, typename arg_ty = decltype(class_ty::a) &gt;
      static int fTest(int, arg_ty &amp; = class_ty::a);
  
      enum nRes { result = sizeof(fTest&lt;My_Type&gt;(0)) - 1 };
  };
  
  int main(void)
  {
      int i;
  
      i = TestStatic&lt;A1&gt;::result;
      std::cout &lt;&lt; i &lt;&lt; std::endl;
      i = TestStatic&lt;A2&gt;::result;
      std::cout &lt;&lt; i &lt;&lt; std::endl;
      _getch();
      return(0);
  }
  </code></pre>
  
  <p>The question is when it was built with g++ 4.8 the compiling passed but got the result as two '3's rather than one '0' and another '3'. Is there anything wrong?</p>