This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/56677] New: [ratio] : ratio_multiply, ratio_divide, etc results doesnt verify as __is_ratio
- From: "npl at chello dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 21 Mar 2013 13:00:15 +0000
- Subject: [Bug libstdc++/56677] New: [ratio] : ratio_multiply, ratio_divide, etc results doesnt verify as __is_ratio
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56677
Bug #: 56677
Summary: [ratio] : ratio_multiply, ratio_divide, etc results
doesnt verify as __is_ratio
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: npl@chello.at
within chrono there is a test for template parameters if they classify as
ratios: __is_ratio
this test only works if the type is constructed as ratio<>, but the arithmetic
functions on ratio ratio_multiply, ratio_divide, .. dont generate the result
this way.
Here is a little programm to illustrate the issue:
------------------------------------------------------------------
#include <ratio>
#include <chrono>
typedef std::ratio_divide<std::ratio<1>, std::ratio<1> > ratii1;
typedef std::ratio<ratii1::num,ratii1::den > ratii2;
std::chrono::duration<unsigned long, ratii1 > d1; // compile time check raises
error
std::chrono::duration<unsigned long, ratii2 > d2; // works fine.
------------------------------------------------------------------
the solution would be either to make the __is_ratio smarter or, just generate
results like I did with ratii2.