aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-11 18:00:20 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-11 18:00:20 -0400
commitac4b1cc036b88ed7e82c1c755b39568064e9f2e0 (patch)
treebf33c55921fbb1319b6ae682ceca79aa585cc2b6
parentb24290fb5bfba313dc7143aa29a7b161fd501997 (diff)
downloadgcc-ac4b1cc036b88ed7e82c1c755b39568064e9f2e0.zip
gcc-ac4b1cc036b88ed7e82c1c755b39568064e9f2e0.tar.gz
gcc-ac4b1cc036b88ed7e82c1c755b39568064e9f2e0.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C13
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 10400516..7a087c5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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
* call.c (reference_binding): Allow rvalue reference to bind to
function lvalue.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d6b6197..ad004bb 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2423,7 +2423,7 @@ maybe_dummy_object (tree type, tree* binfop)
else if (current != current_class_type
&& context == nonlambda_method_basetype ())
/* In a lambda, need to go through 'this' capture. */
- decl = (cp_build_indirect_ref
+ decl = (build_x_indirect_ref
((lambda_expr_this_capture
(CLASSTYPE_LAMBDA_EXPR (current_class_type))),
RO_NULL, tf_warning_or_error));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3812fef..05beba0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2011-04-11 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/lambda/lambda-this4.C: New.
+
* g++.dg/cpp0x/rv-func.C: New.
2011-04-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C
new file mode 100644
index 0000000..29cd2a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C
@@ -0,0 +1,13 @@
+// PR c++/48523
+// { dg-options -std=c++0x }
+
+template<typename>
+struct X
+{
+ bool b;
+
+ void f()
+ {
+ [this]{ return b; };
+ }
+};