title: template-id does not match any template declaration
body: <p>I'm not sure why specialization of the <code>size</code> function template for <code>TCollection</code> fails.</p>
  
  <pre><code>template &lt;typename C&gt;
  using detect_size = decltype(std::declval&lt;C&gt;().size());
  
  template &lt;typename C&gt;
  constexpr auto size(const C&amp; c) -&gt; decltype(c.size()) { return c.size(); }
  
  template &lt;typename C&gt;
  inline std::enable_if_t&lt;
    !is_detected&lt;detect_size,C&gt;::value, size_t &gt;
  size(const C&amp; c) { return std::distance( std::begin(c), std::end(c) ); }
  
  template &lt;class T, size_t N&gt;
  constexpr size_t size(const T (&amp;array)[N]) noexcept { return N; }
  
  template &lt;&gt;
  auto size&lt;TCollection&gt;(const TCollection&amp; c) { return c.GetSize(); }
  </code></pre>
  
  <p>GCC gives me</p>
  
  <pre><code>error: template-id 'size&lt;TCollection&gt;' for 'auto size(const TCollection&amp;)'
  does not match any template declaration
  </code></pre>
  
  <p><code>is_detected</code> is implemented as <a href="http://en.cppreference.com/w/cpp/experimental/is_detected" rel="nofollow noreferrer">here</a>.</p>
  
  <p>EDIT:</p>
  
  <ul>
  <li>Specifying return type explicitly doesn't change anything;</li>
  <li>If I use overloading, the implementation using <code>std::distance</code> gets picked up.</li>
  </ul>
  
  <p>Overload code:</p>
  
  <pre><code>auto size(const TCollection&amp; c) { return c.GetSize(); }
  </code></pre>