title: Why does type deduction fail once, but succeed another time in two very similar cases?
body: <p>I was trying to write a <strong>function</strong> that gives the <strong>max size of</strong> a given <strong>list of types</strong>, this was my first attempt...</p>
  
  <pre><code>template&lt;typename T&gt;
  size_t maxsizeof() {
      return sizeof(T);
  }
  
  template&lt;typename T, typename... Args&gt;
  size_t maxsizeof() {
      if (sizeof(T) &gt; maxsizeof&lt;Args...&gt;()) {
          return sizeof(T);
      }
      return maxsizeof&lt;Args...&gt;();
  }
  
  int main() {
      size_t a = maxsizeof&lt;short,float,double&gt;(); //FAILS
  }
  </code></pre>
  
  <p>But this code <strong>fails to compile</strong> on the last recursive call of <code>maxsizeof&lt;double&gt;()</code> and says that it is an <strong>ambiguous function call</strong>.</p>
  
  <p>This seemed a little weird to me as I have wrote base cases like that in the past, and it always worked, so I went ahead and wrote it with <strong>actual parameters</strong> as I am more experienced with.... </p>
  
  <pre><code>template&lt;typename T&gt;
  size_t maxsizeof_with_parameters(T num) {
      return sizeof(T);
  }
  
  template&lt;typename T, typename... Args&gt;
  size_t maxsizeof_with_parameters(T num, Args... args) {
      if (sizeof(T) &gt; maxsizeof_with_parameters&lt;Args...&gt;(args...)) {
          return sizeof(T);
      }
      return maxsizeof_with_parameters&lt;Args...&gt;(args...);
  }
  
  int main() {
      size_t b = maxsizeof_with_parameters&lt;short,float,double&gt;(1,2,3);
  }
  </code></pre>
  
  <p>And weirdly enough, <strong>this worked</strong>, but the only thing I did differently was <em>include</em> the parameters, <em>I didn't even use them</em>. </p>
  
  <p>Why does this happen? What is an alternative way to write the function without the throw-away parameters?</p>
  
  <p>(Preferably I would also want this to be able to be done at compile time, though I got rid of some constexpr's so we could get to the meat of the problem)</p>