Skip to content

Commit

Permalink
Test floating point overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
robincaloudis committed Sep 5, 2024
1 parent 54194e1 commit 7804824
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libcxx/test/std/numerics/c.math/signbit.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,22 @@ struct TestInt {
}
};

template <typename T>
struct ConvertibleTo {
operator T() const { return T(); }
};

int main(int, char**) {
types::for_each(types::floating_point_types(), TestFloat());
types::for_each(types::integral_types(), TestInt());

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

0 comments on commit 7804824

Please sign in to comment.