title: Why Must Specializing Argument be void?
body: <p>So yet another question in <a href="https://stackoverflow.com/q/56649481/2642059">this saga</a>. <a href="https://stackoverflow.com/users/2104697/guillaume-racicot">Guillaume Racicot</a> has been good enough to provide me with <a href="https://stackoverflow.com/a/56650205/2642059">yet another workaround</a> so this is the code I'll be basing this question off of:</p>
  
  <pre><code>struct vec
  {
      double x;
      double y;
      double z;
  };
  
  namespace details
  {
  template &lt;typename T&gt;
  using subscript_function = double(*)(const T&amp;);
  
  template &lt;typename T&gt;
  constexpr double X(const T&amp; param) { return param.x; }
  
  template &lt;typename T&gt;
  constexpr double Y(const T&amp; param) { return param.y; }
  
  template &lt;typename T&gt;
  constexpr double Z(const T&amp; param) { return param.z; }
  }
  
  template &lt;typename T, typename = void&gt;
  constexpr details::subscript_function&lt;T&gt; my_temp[] = { &amp;details::X&lt;T&gt;, &amp;details::Y&lt;T&gt; };
  
  template &lt;typename T&gt;
  constexpr details::subscript_function&lt;T&gt; my_temp&lt;T, enable_if_t&lt;is_floating_point_v&lt;decltype(details::X(T()))&gt;, T&gt;&gt;[] = { &amp;details::X&lt;T&gt;, &amp;details::Y&lt;T&gt;, &amp;details::Z&lt;T&gt; };
  
  
  int main() {
      vec foo = { 1.0, 2.0, 3.0 };
  
      for(const auto i : my_temp&lt;decltype(foo)&gt;) {
          cout &lt;&lt; (*i)(foo) &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>The problem seems to arise in my specialization when I return something <em>other</em> than <code>void</code>. In the code above for example, <code>enable_if_t&lt;is_floating_point_v&lt;decltype(details::X(T()))&gt;, T&gt;</code> prevents specialization, while simply removing the last argument and allowing <code>enable_if</code> to return <code>void</code> allows specialization.</p>
  
  <p>I think this points to my misunderstanding of what is really happening here. Why must the specialized type always be <code>void</code> for this to work?</p>
  
  <p><a href="https://ideone.com/pYqiUS" rel="noreferrer"><kbd>Live Example</kbd></a></p>