public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gasper.azman at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/102609] [C++23] P0847R7 - Deducing this
Date: Sat, 02 Sep 2023 22:30:28 +0000 [thread overview]
Message-ID: <bug-102609-4-yLzXC0b7Si@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102609-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102609
--- Comment #19 from Gašper Ažman <gasper.azman at gmail dot com> ---
Correct, the use of the capture is the source of the error, not the
instantiation with an unrelated type.
On Sat, Sep 2, 2023, 09:54 waffl3x at protonmail dot com <
gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102609
>
> --- Comment #18 from waffl3x <waffl3x at protonmail dot com> ---
> (In reply to Gašper Ažman from comment #17)
> > Read through the patch quickly, want to suggest a few tests.
> >
> > When a lambda has captures, the explicit object parameter is used to get
> at
> > them *silently*, if they are related, otherwise the program is
> ill-formed:
> >
> > int x = 42;
> > auto f1 = [x](this auto&&) {
> > return x;
> > };
> > auto f2 = [](this auto&&) { return 42; }
> >
> > static_cast<int(*)(decltype(f1)&)>(decltype(f1)::operator()); // OK
> > static_cast<int(*)(int&)>(decltype(f1)::operator()); // ERROR
> > static_cast<int(*)(int&)>(decltype(f2)::operator()); // OK
>
> Ah I see, thanks for the input. I was actually wondering about that,
> especially
> if you were expected to use the explicit object parameter to access
> captures.
> Is my understanding correct that the second case would not be an error if
> captures were not used in the body of the lambda? Based on your wording I
> would
> believe that is the case, so implementing this behavior would not be as
> simple
> as just disallowing unrelated deduced types when there are captures.
>
> Unfortunately, I will not have access to my computer for a while more, I
> plan
> on setting up an environment at another computer and fixing the formatting
> errors that were noted, but I will wait until I have access to my computer
> before I work on it more seriously I think.
>
> Thanks a lot for looking at the patch though, I really appreciate the time
> you've taken.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
next prev parent reply other threads:[~2023-09-02 22:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 15:56 [Bug c++/102609] New: " mpolacek at gcc dot gnu.org
2021-11-28 11:33 ` [Bug c++/102609] " pinskia at gcc dot gnu.org
2023-06-12 23:37 ` mpolacek at gcc dot gnu.org
2023-08-16 18:29 ` waffl3x at protonmail dot com
2023-08-16 18:48 ` gasper.azman at gmail dot com
2023-08-16 18:50 ` gasper.azman at gmail dot com
2023-08-16 21:58 ` waffl3x at protonmail dot com
2023-08-19 8:44 ` waffl3x at protonmail dot com
2023-08-19 9:38 ` redi at gcc dot gnu.org
2023-08-19 9:43 ` redi at gcc dot gnu.org
2023-08-19 16:10 ` gasper.azman at gmail dot com
2023-08-19 21:24 ` waffl3x at protonmail dot com
2023-08-20 14:21 ` gasper.azman at gmail dot com
2023-08-21 1:24 ` waffl3x at protonmail dot com
2023-08-21 15:17 ` barry.revzin at gmail dot com
2023-08-25 11:28 ` waffl3x at protonmail dot com
2023-08-31 6:50 ` waffl3x at protonmail dot com
2023-08-31 9:28 ` gasper.azman at gmail dot com
2023-09-02 8:54 ` waffl3x at protonmail dot com
2023-09-02 22:30 ` gasper.azman at gmail dot com [this message]
2024-01-09 21:56 ` cvs-commit at gcc dot gnu.org
2024-01-09 21:56 ` cvs-commit at gcc dot gnu.org
2024-01-09 21:56 ` cvs-commit at gcc dot gnu.org
2024-01-09 21:56 ` cvs-commit at gcc dot gnu.org
2024-01-09 21:57 ` cvs-commit at gcc dot gnu.org
2024-01-11 20:47 ` corentinjabot at gmail dot com
2024-01-11 21:08 ` waffl3x at protonmail dot com
2024-01-11 22:00 ` gasper.azman at gmail dot com
2024-01-11 22:01 ` jakub at gcc dot gnu.org
2024-01-12 0:26 ` waffl3x at protonmail dot 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=bug-102609-4-yLzXC0b7Si@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).