From: Jonathan Wakely Date: Fri, 2 Dec 2022 16:18:43 +0000 (+0000) Subject: libstdc++: Change class-key for duration and time_point to class X-Git-Tag: basepoints/gcc-14~2636 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7eec3114ebe8d4c55c64b4e47546d3d8f95eb09b;p=thirdparty%2Fgcc.git libstdc++: Change class-key for duration and time_point to class 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'. --- diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h index cabf61264d89..496e9485a73b 100644 --- a/libstdc++-v3/include/bits/chrono.h +++ b/libstdc++-v3/include/bits/chrono.h @@ -59,11 +59,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// `chrono::duration` represents a distance between two points in time template> - struct duration; + class duration; /// `chrono::time_point` represents a point in time as measured by a clock template - struct time_point; + class time_point; /// @} } @@ -431,14 +431,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @endcond template - 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 using __is_float = treat_as_floating_point<_Rep2>; @@ -844,11 +843,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #undef _GLIBCXX_CHRONO_INT64_T template - 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;