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: unassig...@gcc.gnu.org

        ReportedBy: n...@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.

Reply via email to