Commit ac4b1cc0 by Jason Merrill Committed by Jason Merrill

re PR c++/48523 ([C++0x] lambda cannot capture 'this' in class template)

	PR c++/48523
	* tree.c (maybe_dummy_object): Use build_x_indirect_ref rather
	than cp_build_indirect_ref.

From-SVN: r172283
parent b24290fb
2011-04-11 Jason Merrill <jason@redhat.com> 2011-04-11 Jason Merrill <jason@redhat.com>
PR c++/48523
* tree.c (maybe_dummy_object): Use build_x_indirect_ref rather
than cp_build_indirect_ref.
PR c++/48457, Core 1238 PR c++/48457, Core 1238
* call.c (reference_binding): Allow rvalue reference to bind to * call.c (reference_binding): Allow rvalue reference to bind to
function lvalue. function lvalue.
......
...@@ -2423,7 +2423,7 @@ maybe_dummy_object (tree type, tree* binfop) ...@@ -2423,7 +2423,7 @@ maybe_dummy_object (tree type, tree* binfop)
else if (current != current_class_type else if (current != current_class_type
&& context == nonlambda_method_basetype ()) && context == nonlambda_method_basetype ())
/* In a lambda, need to go through 'this' capture. */ /* In a lambda, need to go through 'this' capture. */
decl = (cp_build_indirect_ref decl = (build_x_indirect_ref
((lambda_expr_this_capture ((lambda_expr_this_capture
(CLASSTYPE_LAMBDA_EXPR (current_class_type))), (CLASSTYPE_LAMBDA_EXPR (current_class_type))),
RO_NULL, tf_warning_or_error)); RO_NULL, tf_warning_or_error));
......
2011-04-11 Jason Merrill <jason@redhat.com> 2011-04-11 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/lambda/lambda-this4.C: New.
* g++.dg/cpp0x/rv-func.C: New. * g++.dg/cpp0x/rv-func.C: New.
2011-04-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2011-04-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
......
// PR c++/48523
// { dg-options -std=c++0x }
template<typename>
struct X
{
bool b;
void f()
{
[this]{ return b; };
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment