]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Change class-key for duration and time_point to class
authorJonathan Wakely <jwakely@redhat.com>
Fri, 2 Dec 2022 16:18:43 +0000 (16:18 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 9 Dec 2022 00:32:44 +0000 (00:32 +0000)
We define these with the 'struct' keyword, but the standard uses
'class'. This results in warnings if users try to refer to them using
elaborated type specifiers.

libstdc++-v3/ChangeLog:

* include/bits/chrono.h (duration, time_point): Change 'struct'
to 'class'.

libstdc++-v3/include/bits/chrono.h

index cabf61264d895d526dab7443c2b57ec1aa6b9096..496e9485a73b5f4782ccacea796de1da1223d537 100644 (file)
@@ -59,11 +59,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     /// `chrono::duration` represents a distance between two points in time
     template<typename _Rep, typename _Period = ratio<1>>
-      struct duration;
+      class duration;
 
     /// `chrono::time_point` represents a point in time as measured by a clock
     template<typename _Clock, typename _Dur = typename _Clock::duration>
-      struct time_point;
+      class time_point;
     /// @}
   }
 
@@ -431,14 +431,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     /// @endcond
 
     template<typename _Rep, typename _Period>
-      struct duration
+      class duration
       {
        static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
        static_assert(__is_ratio<_Period>::value,
                      "period must be a specialization of ratio");
        static_assert(_Period::num > 0, "period must be positive");
 
-      private:
        template<typename _Rep2>
          using __is_float = treat_as_floating_point<_Rep2>;
 
@@ -844,11 +843,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #undef _GLIBCXX_CHRONO_INT64_T
 
     template<typename _Clock, typename _Dur>
-      struct time_point
+      class time_point
       {
        static_assert(__is_duration<_Dur>::value,
            "duration must be a specialization of std::chrono::duration");
 
+      public:
        typedef _Clock                                          clock;
        typedef _Dur                                            duration;
        typedef typename duration::rep                          rep;
This page took 0.055844 seconds and 5 git commands to generate.