[LLVMbugs] [Bug 18218] New: incorrect implementation of isnan and similar functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 11 15:12:46 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18218

            Bug ID: 18218
           Summary: incorrect implementation of isnan and similar
                    functions
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: gratal at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The standard specifies in [c.math] that isnan and other classification
functions must have the following overloads:

   bool isnan(float x);
   bool isnan(double x);
   bool isnan(long double x);

Implementing it as a template seems like a good idea, except that the following
valid code is rejected:

   #include <cmath>

   struct A {
      operator float()   {    return 0.0;  }
   };

   int main() {
      std::isnan(A());
   }

The template should be enabled for every type that is convertible to an
arithmetic type, to make the implementation indistinguishable from what is
specified in the standard.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131211/f82a93fd/attachment.html>


More information about the llvm-bugs mailing list