This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/53840] New: [C++11] DR 921. Rational Arithmetic should use template aliases


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]