public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libitm: small update for C++20
Date: Mon, 5 Feb 2024 10:15:01 -0500	[thread overview]
Message-ID: <33d7ca3c-e361-4405-b8e0-efbad6b7c75a@redhat.com> (raw)
In-Reply-To: <20240203151459.1198772-1-polacek@redhat.com>

On 2/3/24 10:14, Marek Polacek wrote:
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?

OK.

> -- >8 --
> C++20 DR 2237 disallows simple-template-id in cdtors, so you
> can't write
> 
>      template<typename T>
>      struct S {
>        S<T>(); // should be S();
>      };
> 
> This hasn't been a problem until now but I'm adding a warning about it
> to -Wc++20-compat which libitm apparently uses.
> 
> libitm/ChangeLog:
> 
> 	* containers.h (vector): Remove the template-id in constructors.
> ---
>   libitm/containers.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libitm/containers.h b/libitm/containers.h
> index 2842fa038ed..4160b16d569 100644
> --- a/libitm/containers.h
> +++ b/libitm/containers.h
> @@ -48,7 +48,7 @@ class vector
>     static const size_t default_resize_min = 32;
>   
>     // Don't try to copy this vector.
> -  vector<T, alloc_separate_cl>(const vector<T, alloc_separate_cl>& x);
> +  vector(const vector<T, alloc_separate_cl>& x);
>   
>    public:
>     typedef T datatype;
> @@ -59,7 +59,7 @@ class vector
>     T& operator[] (size_t pos) { return entries[pos]; }
>     const T& operator[] (size_t pos) const  { return entries[pos]; }
>   
> -  vector<T, alloc_separate_cl>(size_t initial_size = default_initial_capacity)
> +  vector(size_t initial_size = default_initial_capacity)
>       : m_capacity(initial_size),
>         m_size(0)
>     {
> @@ -68,7 +68,7 @@ class vector
>       else
>         entries = 0;
>     }
> -  ~vector<T, alloc_separate_cl>() { if (m_capacity) free(entries); }
> +  ~vector() { if (m_capacity) free(entries); }
>   
>     void resize(size_t additional_capacity)
>     {
> 
> base-commit: 78005c648921899a674d1e561b49b05ccabedfe0


      reply	other threads:[~2024-02-05 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-03 15:14 Marek Polacek
2024-02-05 15:15 ` Jason Merrill [this message]

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=33d7ca3c-e361-4405-b8e0-efbad6b7c75a@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /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).