===================================================================
@@ -185,15 +185,15 @@
__safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value,
__safe_multiply<_R1::den, (_R2::den / __gcd)>::value> type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_add<_R1, _R2>::num;
+ constexpr intmax_t ratio_add<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_add<_R1, _R2>::den;
+ constexpr intmax_t ratio_add<_R1, _R2>::den;
/// ratio_subtract
template<typename _R1, typename _R2>
@@ -203,15 +203,15 @@
_R1,
ratio<-_R2::num, _R2::den>>::type type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_subtract<_R1, _R2>::num;
+ constexpr intmax_t ratio_subtract<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_subtract<_R1, _R2>::den;
+ constexpr intmax_t ratio_subtract<_R1, _R2>::den;
/// ratio_multiply
template<typename _R1, typename _R2>
@@ -230,15 +230,15 @@
__safe_multiply<(_R1::den / __gcd2),
(_R2::den / __gcd1)>::value> type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_multiply<_R1, _R2>::num;
+ constexpr intmax_t ratio_multiply<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_multiply<_R1, _R2>::den;
+ constexpr intmax_t ratio_multiply<_R1, _R2>::den;
/// ratio_divide
template<typename _R1, typename _R2>
@@ -250,15 +250,15 @@
_R1,
ratio<_R2::den, _R2::num>>::type type;
- static const intmax_t num = type::num;
- static const intmax_t den = type::den;
+ static constexpr intmax_t num = type::num;
+ static constexpr intmax_t den = type::den;
};
template<typename _R1, typename _R2>
- const intmax_t ratio_divide<_R1, _R2>::num;
+ constexpr intmax_t ratio_divide<_R1, _R2>::num;
template<typename _R1, typename _R2>
- const intmax_t ratio_divide<_R1, _R2>::den;
+ constexpr intmax_t ratio_divide<_R1, _R2>::den;
/// ratio_equal
template<typename _R1, typename _R2>
===================================================================
@@ -1,5 +1,7 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
// Copyright (C) 2010 Free Software Foundation, Inc.
//
===================================================================
@@ -1,5 +1,7 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
// Copyright (C) 2010 Free Software Foundation, Inc.
//
===================================================================
@@ -1,5 +1,7 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
// Copyright (C) 2010 Free Software Foundation, Inc.
//
===================================================================
@@ -49,6 +49,12 @@
int main()
{
__gnu_test::constexpr_member_data test;
- test.operator()<std::ratio<600, 900>>();
+ typedef std::ratio<600, 900> R1;
+ typedef std::ratio<700, 200> R2;
+ test.operator()<R1>();
+ test.operator()<std::ratio_add<R1, R2>>();
+ test.operator()<std::ratio_subtract<R1, R2>>();
+ test.operator()<std::ratio_multiply<R1, R2>>();
+ test.operator()<std::ratio_divide<R1, R2>>();
return 0;
}