Skip to content

Commit 7804824

Browse files
committed
Test floating point overloads
1 parent 54194e1 commit 7804824

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

libcxx/test/std/numerics/c.math/signbit.pass.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,22 @@ struct TestInt {
7070
}
7171
};
7272

73+
template <typename T>
74+
struct ConvertibleTo {
75+
operator T() const { return T(); }
76+
};
77+
7378
int main(int, char**) {
7479
types::for_each(types::floating_point_types(), TestFloat());
7580
types::for_each(types::integral_types(), TestInt());
7681

82+
// Make sure we can call `std::signbit` with convertible types. This checks
83+
// whether overloads for all cv-unqualified floating-point types are working
84+
// as expected.
85+
{
86+
assert(!std::signbit(ConvertibleTo<float>()));
87+
assert(!std::signbit(ConvertibleTo<double>()));
88+
assert(!std::signbit(ConvertibleTo<long double>()));
89+
}
7790
return 0;
7891
}

0 commit comments

Comments
 (0)