public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] c++: Extend -Wredundant-move for const-qual objects [PR90428]
Date: Tue, 9 Aug 2022 11:08:14 -0400	[thread overview]
Message-ID: <YvJ4XrbbixdsdRQN@redhat.com> (raw)
In-Reply-To: <YvFxnuEhiqRkdMeu@redhat.com>

On Mon, Aug 08, 2022 at 04:27:10PM -0400, Marek Polacek wrote:
> +  /* Also try to warn about redundant std::move in code such as
> +      T f (const T& t)
> +      {
> +	return std::move(t);
> +      }
> +    for which EXPR will be something like
> +      *std::move<const T&> ((const struct T &) (const struct T *) t)
> +     and where the std::move does nothing if T does not have a T(const T&&)
> +     constructor, because the argument is const.  It will not use T(T&&)
> +     because that would mean losing the const.  */
> +  else if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE

This is TYPE_REF_P so I'll fix that up.

> +	   && CP_TYPE_CONST_P (TREE_TYPE (TREE_TYPE (arg))))

Marek


  reply	other threads:[~2022-08-09 15:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-06 18:13 [PATCH] " Marek Polacek
2022-08-06 23:58 ` Jason Merrill
2022-08-08 20:27   ` [PATCH v2] " Marek Polacek
2022-08-09 15:08     ` Marek Polacek [this message]
2022-08-15 19:43     ` Jason Merrill
2022-08-17 19:09       ` Marek Polacek

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=YvJ4XrbbixdsdRQN@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@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).