public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: waffl3x <waffl3x@protonmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v3 1/2] c++: Initial support for P0847R7 (Deducing This) [PR102609]
Date: Wed, 18 Oct 2023 10:17:32 -0400	[thread overview]
Message-ID: <edd9e4fa-5c71-4d54-8329-b747d4739b92@redhat.com> (raw)
In-Reply-To: <wIuguSCXzBTMTwXd5TtshuUboyKIpAZiwzaw9WH8KmccAJsz49viLYJrzbqbQFAUvaWVKlPvT0AI1xbjPPu_Daov5vUcowS0ZexHJWjjjW4=@protonmail.com>

On 10/18/23 07:46, waffl3x wrote:
>> Any progress on this, or do I need to coax the process along?  :)
> 
> Yeah, I've been working on it since the copyright assignment process
> has finished, originally I was going to note that on my next update
> which I had hoped to finish today or tomorrow. Well, in truth I was
> hoping to send one the same day that copyright assignment finished, but
> I found a nasty bug so I spent all day adding test cases for all the
> relevant overloadable operators. Currently, it crashes when calling a
> subscript operator declared with an explicit object parameter in a
> dependent context. I haven't looked into the fix yet, but I plan to.
> 
> Also, before I forget, what is the process for confirming my copyright
> assignment on your end? Do you just need to check in with the FSF to
> see if it went through? Let me know if there's anything you need from
> me regarding that.
> 
> Aside from the bug that's currently present in the first patch, I only
> have like 1 or 2 little things I want to change about it. I will make
> those few changes to patch 1, finish patch 2 (diagnostics) which will
> also include test cases for the new bug I found. After I am done that I
> plan on adding the things that are missing, because I suspect that
> looking into that will get me close to finding the fix for the crash.
> 
>> Hmm, is it? I see that clang thinks so, but I don't know where they get
>> that idea from. The grammar certainly allows it:
>>
>>> attribute-specifier-seqopt decl-specifier-seq declarator = initializer-clause
>>
>> and I don't see anything else that prohibits it.
> 
> You would be right for P0847R7, but CWG DR 2653 changed that. You can
> find the updated grammar in dcl.fct section 3 (subsection? I'm not
> really sure to be honest.)
> 
> I've also included a copy of the grammar here for your convenience.
> 
> https://eel.is/c++draft/dcl.fct#nt:parameter-declaration
> parameter-declaration:
>    attribute-specifier-seqopt thisopt decl-specifier-seq declarator
>    attribute-specifier-seqopt decl-specifier-seq declarator = initializer-clause
>    attribute-specifier-seqopt thisopt decl-specifier-seq abstract-declaratoropt
>    attribute-specifier-seqopt decl-specifier-seq abstract-declaratoropt = initializer-clause

Ah, yes, thanks.

>> I was thinking to set a TREE_LANG_FLAG on the TREE_LIST node.
> 
> I did figure this is originally what you meant, and I can still change
> it to go this route since I'm sure it's likely just as good. But I do
> recall something I didn't like in the implementation that nudged me
> towards using the purpose member instead. Either way, not a big deal. I
> think I just liked not having to mess with a linked list as I am not
> used to them as a data structure, it might have been that simple. :^)

I wouldn't expect to need any actual dealing with the linked list, just 
setting a flag in cp_parameter_declaration_list at the same point as the 
existing PARENTHESIZED_LIST_P flag.

But given CWG2653 as you pointed out, your current approach is fine.

> I will try to get something done today, but I was struggling with
> writing some of the tests, there's also a lot more of them now. I also
> wrote a bunch of musings in comments that I would like feedback on.
> 
> My most concrete question is, how exactly should I be testing a
> pedwarn, I want to test that I get the correct warning and error with
> the separate flags, do I have to create two separate tests for each one?

Yes.  I tend to use letter suffixes for tests that vary only in flags 
(and expected results), e.g. feature1a.C, feature1b.C.

> I'm just going to include the little wall I wrote in decl.cc regarding
> pedwarn, just in case I can't get this done tonight so I can get some
> feedback regarding it. On the other hand, it might just not be very
> relevant to this patch in particular as I kind of noted, but maybe
> there's some way to do what I was musing about that I've overlooked. It
> does end up a bit ranty I guess, hopefully that doesn't make it
> confusing.
> 
> ```
> /* I believe we should make a switch for this feature specifically,
>     I recall seeing discussion regarding enabling newer language
>     features when set to older standards. I would advocate for a
>     specific flag for each specific feature. Maybe they should all
>     be under an override flag? -foverride-dialect=xobj,ifconstexpr (?)
>     I dont think it makes sense to give each feature override it's own
>     flag. I don't recall what the consensus was around this discussion
>     either though.
>
>     For the time being it's controlled by pedantic. I am concerned that
>     tying this to pedantic going forward that one might want to enable
>     -pedantic-errors while also enabling select features from newer
>     dialects. It didn't look like this use case is supported to me.
> 
>     I suppose this will require redesign work to support, so for
>     the purposes of this patch, emitting a pedwarn seems correct.
>     I just don't like that it can't be suppressed on an individual
>     basis.  */
> if (xobj_parm && cxx_dialect < cxx23)
>    pedwarn(DECL_SOURCE_LOCATION (xobj_parm), OPT_Wpedantic, "");

Instead of OPT_Wpedantic, this should be controlled by 
-Wc++23-extensions (OPT_Wc__23_extensions)

If you wanted, you could add a more specific warning option for this 
(e.g. -Wc++23-explicit-this) which is also affected by 
-Wc++23-extensions, but I would lean toward just using the existing 
flag.  Up to you.

Jason


  reply	other threads:[~2023-10-18 14:17 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  6:02 [PATCH " waffl3x
2023-08-31  8:33 ` Jakub Jelinek
2023-09-02  8:43   ` waffl3x
2023-09-11 13:49     ` [PATCH v2 " waffl3x
2023-09-19 20:14       ` Jason Merrill
2023-09-20  0:30         ` waffl3x
2023-09-20 21:19           ` Jason Merrill
2023-09-21 11:28             ` waffl3x
2023-09-22 11:30               ` Jason Merrill
2023-09-26  1:56                 ` [PATCH v3 " waffl3x
2023-09-27 22:43                   ` Hans-Peter Nilsson
2023-09-27 23:35                     ` Waffl3x
2023-10-17 20:53                   ` Jason Merrill
2023-10-17 21:11                   ` Jason Merrill
2023-10-18 11:46                     ` waffl3x
2023-10-18 14:17                       ` Jason Merrill [this message]
2023-10-18 17:28                         ` waffl3x
2023-10-18 17:45                           ` Jakub Jelinek
2023-10-18 18:12                           ` Jason Merrill
2023-10-19 21:05                             ` waffl3x
2023-10-19 21:11                               ` Jakub Jelinek
2023-10-19 21:31                                 ` waffl3x
2023-10-19 21:53                                   ` Jakub Jelinek
2023-10-19 22:18                               ` Jason Merrill
     [not found]                                 ` <Q2xXS2RkwtzDslDUAsi4YWupkb9s3QKvecqsxLNUr=5FL-MdSmzIJcZ96S3B9Avk30GneMm8R67JsQ4D-Uj1JB6N8dhTw6LAlNsrpLKHuLP2o=3D@protonmail.com>
2023-10-19 22:51                                 ` waffl3x
2023-10-19 23:35                                   ` waffl3x
2023-10-20  2:39                                     ` Jason Merrill
2023-10-20  4:34                                       ` waffl3x
2023-10-20 16:01                                         ` Jason Merrill
     [not found]                                           ` <zXWkSXEO=5FH62WXyNUeV1zNAx9wSVGQ5ooxKAfpN2InCP4X25uOC0yTZlnMqbDMoIa4lGwj0hP-KEP5UIcMs1S1zkhz=5FZx4oM3oz09DY2BRg=3D@protonmail.com>
     [not found]                                             ` <9YnRZJPkB8KCk8R86UDwWBoNnmOEAir4IU4enb1qIGgVdkB6dwy76ClgAzwpPqpToQ9sLTBs50EIRwhivBJU6RAFfLt-fjJxdYTZ35YVFWA=3D@protonmail.com>
2023-10-28  4:07                                           ` waffl3x
2023-10-28 23:21                                             ` waffl3x
2023-11-01 23:15                                               ` waffl3x
2023-11-02  7:01                                                 ` waffl3x
2023-11-02  7:01                                                 ` Jakub Jelinek
2023-11-03  3:04                                             ` Jason Merrill
2023-11-03  4:44                                               ` waffl3x
2023-11-03 18:05                                                 ` Jason Merrill
2023-11-04  6:40                                                   ` waffl3x
2023-11-09 18:44                                                     ` Jason Merrill
2023-11-10  4:24                                                       ` waffl3x
2023-11-10 23:12                                                         ` Jason Merrill
2023-11-11 10:43                                                           ` waffl3x
2023-11-11 11:24                                                             ` waffl3x
2023-11-14  3:48                                                             ` Jason Merrill
2023-11-14  4:36                                                               ` waffl3x
2023-11-18  6:43                                                                 ` waffl3x
2023-11-19  6:22                                                                   ` Jason Merrill
2023-11-19 13:39                                                                     ` waffl3x
2023-11-19 16:31                                                                       ` Jason Merrill
2023-11-19 18:36                                                                         ` waffl3x
2023-11-19 20:34                                                                           ` Jason Merrill
2023-11-19 21:44                                                                             ` waffl3x
2023-11-20 14:35                                                                               ` Jason Merrill
     [not found]                                                                                 ` <1MdaTybBd=5Fo4uw-Gb23fYyd5GNz7qFqoSe=5Ff5h90LY=5FBdzM2ge2qPSyCuiCLYoYcZSjmVv13fw1LmjQC=5FM2L8raS1fydY5pEJ=5Fvwvv5Z-0k=3D@protonmail.com>
2023-11-21 10:02                                                                                 ` waffl3x
2023-11-21 13:04                                                                                   ` [PATCH v5 1/1] " waffl3x
2023-11-22  3:22                                                                                     ` Jason Merrill
2023-11-22 20:46                                                                                       ` waffl3x
2023-11-22 21:38                                                                                         ` Jason Merrill
     [not found]                                                                                           ` <kltTuyDDwoyOmhBWostMKm5zF3sQCGz3HjMBrBUK6LOZp1-AbGMl5ijKKMlOncwR2yiWippyp89sFPZykNF3OVyz4yknnCVwn=5FiHJPUl25k=3D@protonmail.com>
     [not found]                                                                                             ` <dHEpSeuiljMbH0YhwLULApd3yO3LNaVkamGW2KJBYBl0EgMrtpJZ41GeTVOc77siD1kh2vkF4zwInWWGxYXfcnW4XV7sfDPX7cY028JiORE=3D@protonmail.com>
2023-11-22 21:56                                                                                           ` waffl3x
2023-11-22 22:44                                                                                           ` waffl3x
2023-11-24  6:49                                                                                             ` waffl3x
2023-11-24 23:26                                                                                               ` waffl3x
2023-11-25  1:14                                                                                                 ` waffl3x
2023-11-26 21:30                                                                                                   ` Jason Merrill
2023-11-26 23:10                                                                                                     ` waffl3x
2023-11-27  1:16                                                                                                       ` Jason Merrill
     [not found]                                                                                                         ` <BEI8PD7nktTuX7dimb22uDnR0b8Bc8ozi4xx9KbiEFj8TjgUCxMfEPpcIPL0bkdThBBab97T1uEJ9rUM3va1eiE1TyRw=5FiLrxwKgg30ZaW0=3D@protonmail.com>
2023-11-27  1:30                                                                                                         ` waffl3x
2023-11-27  1:44                                                                                                         ` waffl3x
2023-11-27  2:40                                                                                                           ` Jason Merrill
2023-11-27  5:35                                                                                                           ` [PATCH v6 " waffl3x
2023-11-28  3:31                                                                                                             ` waffl3x
2023-11-28 10:00                                                                                                               ` waffl3x
2023-11-30  5:00                                                                                                             ` Jason Merrill
2023-11-30  6:36                                                                                                               ` waffl3x
2023-11-30 14:55                                                                                                                 ` Jason Merrill
2023-12-01  6:02                                                                                                                   ` waffl3x
2023-12-01 16:52                                                                                                                     ` Jason Merrill
2023-12-02  1:31                                                                                                                       ` waffl3x
2023-12-02 15:02                                                                                                                         ` Jason Merrill
     [not found]                                                                                                                           ` <KQegse=5FguOyql4Ok1lrAgS7gasZJd1pOoPbCTdGxcHh-G4A9Tlf5zCnGJmqtshMt72edmcXdIapaZNPp4VJp5Ar9PHZbUrbwDsPjTSUrnOI=3D@protonmail.com>
     [not found]                                                                                                                             ` <59LofhYhxl7MLEuElXwZcESRB6MpjdG-iq-89B63siDRo5k0j-y6z-PVa6Y3iE1xE5LkJwpwTFi82bd0RZjB1yZbSJptFdPTBWfvOGj1W78=3D@protonmail.com>
2023-12-05  4:35                                                                                                                           ` waffl3x
2023-12-05  4:39                                                                                                                             ` waffl3x
2023-12-05  5:54                                                                                                                               ` waffl3x
2023-12-06  7:33                                                                                                                                 ` [PATCH v7 " waffl3x
2023-12-06  8:48                                                                                                                                   ` Jakub Jelinek
2023-12-06  9:31                                                                                                                                     ` waffl3x
2023-12-06 11:08                                                                                                                                   ` waffl3x
2023-12-08 19:25                                                                                                                                   ` Jason Merrill
2023-12-10 15:22                                                                                                                                     ` waffl3x
2023-12-10 18:59                                                                                                                                       ` Jason Merrill
2023-12-22  9:01                                                                                                                                         ` waffl3x
2023-12-22 17:26                                                                                                                                           ` Jason Merrill
2023-12-23  7:10                                                                                                                                             ` waffl3x
2023-12-26 16:37                                                                                                                                               ` Jason Merrill
2024-01-01 15:17                                                                                                                                                 ` waffl3x
2024-01-01 15:34                                                                                                                                                   ` waffl3x
2024-01-01 17:12                                                                                                                                                     ` waffl3x
2024-01-06 12:37                                                                                                                                                       ` waffl3x
2023-11-25 17:32                                                                                               ` [PATCH v5 " Jason Merrill
2023-11-25 22:59                                                                                                 ` waffl3x
2023-09-19 20:24   ` [PATCH 1/2] " Jason Merrill
     [not found] <b=5FiIXwWwO63ZE1ZSZHUIAdWyA2sqGsE3FM7eXfsInWogDyBZRsw8CwNsvFSDmEVmBtdq0pqb4zJ55HN2JCR7boDNramlEfne-R5PWdUXjbA=3D@protonmail.com>

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=edd9e4fa-5c71-4d54-8329-b747d4739b92@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=waffl3x@protonmail.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).