Summary: | Pointer to member in lambda should not require this to be captured | ||
---|---|---|---|
Product: | gcc | Reporter: | Boris Bigott <boris.bigott> |
Component: | c++ | Assignee: | Jason Merrill <jason> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bruck.michael, daniel.kruegler, jason |
Priority: | P3 | Keywords: | c++-lambda |
Version: | unknown | ||
Target Milestone: | 4.8.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2013-02-06 00:00:00 | |
Bug Depends on: | |||
Bug Blocks: | 54367 |
Description
Boris Bigott
2013-02-06 11:08:58 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? 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. Ok, confirmed. Related to 51494. 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 Fixed for 4.8. This issue applies to 4.7.x too. Any chance to get this backported? Now that 4.8.0 is about to be released, I'm reluctant to backport non-regression C++11 fixes to 4.7. |