title: Why Can't These Templatized Functions Take No Arguments?
body: <p>I am trying to use a couple templatized functions for <a href="https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error" rel="nofollow">Substitution Fail Is Not An Error(SFINAE)</a>. And I can do it like this:</p>
  
  <pre><code>template&lt;typename R, typename S = decltype(declval&lt;R&gt;().test())&gt; static true_type Test(R*);
  template&lt;typename R&gt; static false_type Test(...);
  </code></pre>
  
  <p>But I'm not understanding how the argument makes this SNFIAE work. It seems like I should just be able to remove the arguments and the template selection would work the exact same way:</p>
  
  <pre><code>template&lt;typename R, typename S = decltype(declval&lt;R&gt;().test())&gt; static true_type Test();
  template&lt;typename R&gt; static false_type Test();
  </code></pre>
  
  <p>But it does not, I get:</p>
  
  <blockquote>
    <p>Call of overloaded 'Test()' is ambiguous</p>
  </blockquote>
  
  <p>What is it about these arguments that make this SFINAE work?</p>