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: C++ PATCH for c++/88548, this accepted in static member functions
Date: Tue, 08 Jan 2019 04:08:00 -0000	[thread overview]
Message-ID: <77923dac-487b-526e-804a-d1ac46b5d574@redhat.com> (raw)
In-Reply-To: <20181222213830.GT21364@redhat.com>

On 12/22/18 4:38 PM, Marek Polacek wrote:
> I noticed that we weren't diagnosing using 'this' in noexcept-specifiers
> of static member functions, and Jakub pointed out that this is also true
> for trailing-return-type.  cp_parser has local_variables_forbidden_p to
> detect using local vars and 'this' in certain contexts, so let's use that.
> 
> ...except that I found out that I need to be able to distinguish between
> forbidding just local vars and/or this, so I've changed its type to char.
> For instance, you can't use 'this' in a static member function declaration,
> but you can use a local var because noexcept/decltype is an unevaluated
> context.
> 
> I also noticed that we weren't diagnosing 'this' in a friend declaration,
> which is also forbidden.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

I wonder about suppressing inject_this_parm for a static member 
function, since current_class_ptr is unset within a static member 
function.  But this approach (and patch) is also OK.

Jason

      parent reply	other threads:[~2019-01-08  4:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-23 10:30 Marek Polacek
2019-01-04 14:44 ` Marek Polacek
2019-01-08  4:08 ` 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=77923dac-487b-526e-804a-d1ac46b5d574@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).