This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/53840] New: [C++11] DR 921. Rational Arithmetic should use template aliases
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Jul 2012 15:05:31 +0000
- Subject: [Bug libstdc++/53840] New: [C++11] DR 921. Rational Arithmetic should use template aliases
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53840
Bug #: 53840
Summary: [C++11] DR 921. Rational Arithmetic should use
template aliases
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3358.html#921
This should compile:
#include <chrono>
std::chrono::duration<long, std::ratio_divide<std::kilo, std::milli>> d;
/home/jwakely/gcc/4.x/include/c++/4.8.0/chrono:227:2: error: static assertion
failed: period must be a specialization of ratio
static_assert(__is_ratio<_Period>::value,
^
The obvious implementation would be to rename each ratio_xxx class template to
__ratio_xxx then add:
template<typename _R1, typename _R2>
using ratio_xxx = typename __ratio_xxx<_R1, _R2>::type;