title: Is the microsoft C++ compiler smart enough to know std::isnan isn't called on a integral type in my code?
body: <p>This is related to my earlier post <a href="https://stackoverflow.com/questions/71863599/fpclassify-ambiguous-call-to-overloaded-function?noredirect=1#comment126991680_71863599">&#39;fpclassify&#39;: ambiguous call to overloaded function</a></p>
  <p>I attempted to correct the code that produced the error. The original code looked like the following.</p>
  <pre><code>struct alignas(1) wrapped_int8 {
    using underlying = int8_t;
    int8_t value;
    // some other function definitions
  };
  
  template &lt;typename T&gt;
  void func(T val) {
    auto mask = std::isnan(val);
  }
  
  int main(int argc, char const *argv[])
  {  
    func&lt;wrapped_int8::underlying&gt;(4);
  }
  </code></pre>
  <p>It failed to compile using microsoft compilers because of the <code>fpclassify</code> overload ambiguity issue and the lack of an integral overload to <code>fpclassify</code> for the microsoft build.</p>
  <p>So I changed the <code>func</code> to:</p>
  <pre><code>template &lt;typename T&gt;
  void func(T val) {
    auto mask = std::is_integral&lt;T&gt;::value ? false : std::isnan(val);
  }
  </code></pre>
  <p>but this still gives the same error. With my code's logic, if <code>T</code> is an integral type, we should never have to call <code>std::isnan</code>, so there shouldn't be an issue with <code>fpclassify</code>, but is the compiler smart enough to know that <code>std::isnan</code> won't be called on integral types? If so, why is it still producing this error? If not, how can I fix this problem?</p>