title: C++ ambiguous call to overloaded function with unsigned int
body: <p>This seems inconsistent. I have 3 functions <code>f</code> overloaded for signed types <code>short</code>, <code>int</code> and <code>long long</code>. If you pass an <code>unsigned short</code> then it gets promoted to the next biggest signed type <code>int</code>. However if you pass <code>unsigned int</code> then it doesn't get promoted to signed <code>long long</code> which is what I would expect, rather compiler complains about ambiguous call to overloaded function.</p>
  
  <pre><code>void f(short x) { std::printf("f(short)\n"); }
  void f(int x) { std::printf("f(int)\n"); }
  void f(long long x) { std::printf("f(long long)\n"); }
  
  int main()
  {
      f((unsigned short)0); // Fine: calls f(int)
      // f((unsigned int)0); // Ambiguous: could be f(short), f(int) or f(long long) 
  }
  </code></pre>