Fix ratio arithmetic with zero
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@143519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -55,4 +55,22 @@ int main()
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 127970191639601LL && R::den == 5177331081415LL, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0> R1;
|
||||
typedef std::ratio<0> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 0 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<1> R1;
|
||||
typedef std::ratio<0> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
{
|
||||
typedef std::ratio<0> R1;
|
||||
typedef std::ratio<1> R2;
|
||||
typedef std::ratio_add<R1, R2>::type R;
|
||||
static_assert(R::num == 1 && R::den == 1, "");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user