re PR libstdc++/46303 ('mutex' is not a member of 'std' failures in 30_threads/call_once/constexpr.cc, 30_threads/mutex/cons/constexpr.cc, 30_threads/once_flag/cons/constexpr.cc)

2010-11-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/46303
	* testsuite/30_threads/call_once/constexpr.cc: Add missing dg-require
	directives.
	* testsuite/30_threads/mutex/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/once_flag/cons/constexpr.cc: Likewise.

2010-11-04  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/ratio (ratio_add, ratio_subtract, ratio_multiply,
	ratio_divide): Declare the data members constexpr.
	* testsuite/20_util/ratio/requirements/constexpr_data.cc: Extend.

From-SVN: r166319
This commit is contained in:
Paolo Carlini 2010-11-04 17:02:25 +00:00 committed by Paolo Carlini
parent 822a55a08e
commit 76d0be83b2
6 changed files with 43 additions and 17 deletions

View File

@ -1,3 +1,17 @@
2010-11-04 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/46303
* testsuite/30_threads/call_once/constexpr.cc: Add missing dg-require
directives.
* testsuite/30_threads/mutex/cons/constexpr.cc: Likewise.
* testsuite/30_threads/once_flag/cons/constexpr.cc: Likewise.
2010-11-04 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/ratio (ratio_add, ratio_subtract, ratio_multiply,
ratio_divide): Declare the data members constexpr.
* testsuite/20_util/ratio/requirements/constexpr_data.cc: Extend.
2010-11-03 Benjamin Kosnik <bkoz@redhat.com>
* include/std/tuple (tuple): Make default constructors constexpr.

View File

@ -185,15 +185,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__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 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_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 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__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 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_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>

View File

@ -49,6 +49,12 @@ namespace __gnu_test
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;
}

View File

@ -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.
//

View File

@ -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.
//

View File

@ -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.
//