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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to