public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Change class-key for duration and time_point to class
Date: Fri,  9 Dec 2022 00:35:51 +0000	[thread overview]
Message-ID: <20221209003551.443038-1-jwakely@redhat.com> (raw)

Tested x86_64-linux. Pushed to trunk.

-- >8 --

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 | 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 cabf61264d8..496e9485a73 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<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;
-- 
2.38.1


                 reply	other threads:[~2022-12-09  0:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221209003551.443038-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).