[LLVMbugs] [Bug 22707] New: std::isfinite() does not accept convertible-to-double

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 26 05:57:01 PST 2015


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

            Bug ID: 22707
           Summary: std::isfinite() does not accept convertible-to-double
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

#include <cmath>

struct A {
  A(double x) : x(x) {}
  operator double() const { return x; }

  double x;
};

A a(1.0);
bool z = std::isfinite(a);


error: no matching function for call to 'isfinite'
bool z = std::isfinite(a);
         ^~~~~~~~~~~~~
/code/llvm/build/bin/../include/c++/v1/cmath:376:25: note: candidate template
ignored: disabled by 'enable_if' [with _A1 = A]
typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type



The Standard requires an overload of
 bool isfinite(double x);

Instead, libc++ provides a template implementation with a SFINAE checking for
an arithmetic type.

-- 
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/20150226/ec1fa921/attachment.html>


More information about the llvm-bugs mailing list