public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured
@ 2013-02-06 11:09 boris.bigott at hotmail dot com
2013-02-06 11:33 ` [Bug c++/56222] " paolo.carlini at oracle dot com
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: boris.bigott at hotmail dot com @ 2013-02-06 11:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
Bug #: 56222
Summary: Pointer to member in lambda should not require this to
be captured
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: boris.bigott@hotmail.com
In the example below, gcc complains about this not being captures. This happens
whenever a pointer to a member function is requested in a lambda. I tested with
gcc-4.7.2.
struct Test {
void y() { }
void x() {
[](Test &t) { (t.*(&Test::y))(); }(*this);
}
};
int main() { Test().x(); }
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
@ 2013-02-06 11:33 ` paolo.carlini at oracle dot com
2013-02-06 11:42 ` daniel.kruegler at googlemail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-06 11:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-06 11:32:40 UTC ---
I don't think this is legal, when y isn't static I mean (otherwise it would be
a dup of PR55828). Daniel, what do you think?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
2013-02-06 11:33 ` [Bug c++/56222] " paolo.carlini at oracle dot com
@ 2013-02-06 11:42 ` daniel.kruegler at googlemail dot com
2013-02-06 11:56 ` paolo.carlini at oracle dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-02-06 11:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-02-06 11:42:21 UTC ---
The code looks valid to me, I don't see any reason for capturing something
here. The expression "&Test::y" should be valid in that scope and returns an
rvalue.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
2013-02-06 11:33 ` [Bug c++/56222] " paolo.carlini at oracle dot com
2013-02-06 11:42 ` daniel.kruegler at googlemail dot com
@ 2013-02-06 11:56 ` paolo.carlini at oracle dot com
2013-03-05 17:47 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-06 11:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-06
Blocks| |54367
Ever Confirmed|0 |1
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-06 11:55:51 UTC ---
Ok, confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
` (2 preceding siblings ...)
2013-02-06 11:56 ` paolo.carlini at oracle dot com
@ 2013-03-05 17:47 ` jason at gcc dot gnu.org
2013-03-08 16:04 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-05 17:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-05 17:46:53 UTC ---
Related to 51494.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
` (3 preceding siblings ...)
2013-03-05 17:47 ` jason at gcc dot gnu.org
@ 2013-03-08 16:04 ` jason at gcc dot gnu.org
2013-03-08 16:10 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-08 16:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-08 16:03:57 UTC ---
Author: jason
Date: Fri Mar 8 16:03:48 2013
New Revision: 196549
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196549
Log:
PR c++/51494
PR c++/51884
PR c++/56222
* tree.c (maybe_dummy_object): Don't capture 'this'.
* semantics.c (maybe_resolve_dummy): New.
(finish_non_static_data_member): Use it.
(finish_qualified_id_expr): Don't test is_dummy_object.
* cp-tree.h: Declare maybe_resolve_dummy.
* call.c (build_new_method_call_1): Use it.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/semantics.c
trunk/gcc/cp/tree.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
` (4 preceding siblings ...)
2013-03-08 16:04 ` jason at gcc dot gnu.org
@ 2013-03-08 16:10 ` jason at gcc dot gnu.org
2013-03-17 21:12 ` bruck.michael at googlemail dot com
2013-03-18 3:51 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-08 16:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.8.0
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-08 16:09:29 UTC ---
Fixed for 4.8.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
` (5 preceding siblings ...)
2013-03-08 16:10 ` jason at gcc dot gnu.org
@ 2013-03-17 21:12 ` bruck.michael at googlemail dot com
2013-03-18 3:51 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: bruck.michael at googlemail dot com @ 2013-03-17 21:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
Michael Bruck <bruck.michael at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bruck.michael at googlemail
| |dot com
--- Comment #7 from Michael Bruck <bruck.michael at googlemail dot com> 2013-03-17 21:12:24 UTC ---
This issue applies to 4.7.x too. Any chance to get this backported?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/56222] Pointer to member in lambda should not require this to be captured
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
` (6 preceding siblings ...)
2013-03-17 21:12 ` bruck.michael at googlemail dot com
@ 2013-03-18 3:51 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-18 3:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-18 03:51:11 UTC ---
Now that 4.8.0 is about to be released, I'm reluctant to backport
non-regression C++11 fixes to 4.7.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-03-18 3:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 11:09 [Bug c++/56222] New: Pointer to member in lambda should not require this to be captured boris.bigott at hotmail dot com
2013-02-06 11:33 ` [Bug c++/56222] " paolo.carlini at oracle dot com
2013-02-06 11:42 ` daniel.kruegler at googlemail dot com
2013-02-06 11:56 ` paolo.carlini at oracle dot com
2013-03-05 17:47 ` jason at gcc dot gnu.org
2013-03-08 16:04 ` jason at gcc dot gnu.org
2013-03-08 16:10 ` jason at gcc dot gnu.org
2013-03-17 21:12 ` bruck.michael at googlemail dot com
2013-03-18 3:51 ` jason 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).