public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113810] New: A lambda with this auto style that captures this in a member function cannot use this pointer
@ 2024-02-07 14:44 hewillk at gmail dot com
2024-02-07 14:56 ` [Bug c++/113810] " ppalka at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: hewillk at gmail dot com @ 2024-02-07 14:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113810
Bug ID: 113810
Summary: A lambda with this auto style that captures this in a
member function cannot use this pointer
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
struct S {
int i = 42;
constexpr auto f() {
return [this](this auto) {
return this->i;
}();
};
};
int main() {
return S().f();
}
https://godbolt.org/z/rMqaT9r9E
GCC rejects the above with:
<source>:5:14: error: invalid use of 'this' in non-member function
5 | return this->i;
| ^~~~
But lambda captures this pointer so it should be usable.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/113810] A lambda with this auto style that captures this in a member function cannot use this pointer
2024-02-07 14:44 [Bug c++/113810] New: A lambda with this auto style that captures this in a member function cannot use this pointer hewillk at gmail dot com
@ 2024-02-07 14:56 ` ppalka at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-02-07 14:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113810
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |ppalka at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup
*** This bug has been marked as a duplicate of bug 113563 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-07 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 14:44 [Bug c++/113810] New: A lambda with this auto style that captures this in a member function cannot use this pointer hewillk at gmail dot com
2024-02-07 14:56 ` [Bug c++/113810] " ppalka at gcc dot gnu.org
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).