From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id EB4E33857400; Tue, 28 Mar 2023 23:35:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB4E33857400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680046515; bh=Tu2ZliaO7IG8T4qOjuj38oLSI1SLjgQufD3p4GWY8FE=; h=From:To:Subject:Date:From; b=DZrQ7iVZWX1UIzr7qQ1/YABSP00OPOmB1yZWghuw7tUML7aDfMiiV+UCxSsJOGlq1 XcBETEN1S3Fovkpj+9tXRf10rRADxd4M+RqXCWB1x5btDx91psmcInsoub9tDI+xwH JGlaZX3Ai25Vyk2UB+3r/4xFsop9e70L9D0gEBDM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-9346] libstdc++: Change class-key for duration and time_point to class X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 2fdfa3768b25c85df39eaf9b850e130e42a4dd6f X-Git-Newrev: ffe86c4731532cdbbcb9ea0bf1a33bcd6968db49 Message-Id: <20230328233515.EB4E33857400@sourceware.org> Date: Tue, 28 Mar 2023 23:35:15 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ffe86c4731532cdbbcb9ea0bf1a33bcd6968db49 commit r12-9346-gffe86c4731532cdbbcb9ea0bf1a33bcd6968db49 Author: Jonathan Wakely Date: Fri Dec 2 16:18:43 2022 +0000 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'. (cherry picked from commit 7eec3114ebe8d4c55c64b4e47546d3d8f95eb09b) Diff: --- libstdc++-v3/include/bits/chrono.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h index 65e3e3183f7..36561d94bef 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; /// @} } @@ -440,14 +440,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>; @@ -853,11 +852,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;