title: How to diagnose ambiguous call to sqrt(int&) in g++ 4.3.4
body: <p>My code is as follows:</p>
  
  <pre><code>#include &lt;cmath&gt;
  #include &lt;iostream&gt;
  
  float foo(float f) {
      std::cout &lt;&lt; "float\n";
      return f;
  }
  double foo(double d) {
      std::cout &lt;&lt; "double\n";
      return d;
  }
  
  int main() {
      int i = 16;
  //  foo(i); // ambiguous call, of course
      return (int) std::sqrt(i);
  }
  </code></pre>
  
  <p>The call in the last line is not reported ambiguous even with <code>-pedantic -std=c++98 -Wall -Wextra</code>, but it doesn't necessarily work at all in other compilers, for the same reason <code>foo(i)</code> doesn't. </p>
  
  <p>gcc adds the following to namespace <code>std</code>:</p>
  
  <pre><code>template&lt;typename _Tp&gt;
      inline typename __gnu_cxx::__enable_if&lt;__is_integer&lt;_Tp&gt;::__value,
                                         double&gt;::__type
      sqrt(_Tp __x)
      { return __builtin_sqrt(__x); }
  </code></pre>
  
  <p>That is, it adds <code>inline double sqrt(X)</code> for all integer types X.</p>
  
  <p>I appreciate g++ doing its best to help me out and all, but is there any (legitimate) way to make it diagnose the bug in my code?</p>
  
  <p>[Edit: I'm using gcc 4.3.4, but if other versions of gcc can diagnose it then I'm interested in that fact too!]</p>