diff --git a/libcxx/test/std/numerics/c.math/isnan.pass.cpp b/libcxx/test/std/numerics/c.math/isnan.pass.cpp index fffb1246458629..374aa08a600d60 100644 --- a/libcxx/test/std/numerics/c.math/isnan.pass.cpp +++ b/libcxx/test/std/numerics/c.math/isnan.pass.cpp @@ -62,9 +62,30 @@ struct TestInt { } }; +struct ConvertibleFloat { + int value; + ConvertibleFloat(int v) : value(v) {} + operator float() const { return static_cast(value); } +}; + +struct ConvertibleDouble { + int value; + ConvertibleDouble(int v) : value(v) {} + operator double() const { return static_cast(value); } +}; + +struct ConvertibleLongDouble { + int value; + ConvertibleLongDouble(int v) : value(v) {} + operator long double() const { return static_cast(value); } +}; + int main(int, char**) { types::for_each(types::floating_point_types(), TestFloat()); types::for_each(types::integral_types(), TestInt()); + assert(!std::isnan(ConvertibleFloat(0))); + assert(!std::isnan(ConvertibleDouble(0))); + assert(!std::isnan(ConvertibleLongDouble(0))); return 0; }