re PR c++/48523 ([C++0x] lambda cannot capture 'this' in class template)
authorJason Merrill <jason@redhat.com>
Mon, 11 Apr 2011 22:00:20 +0000 (18:00 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 11 Apr 2011 22:00:20 +0000 (18:00 -0400)
PR c++/48523
* tree.c (maybe_dummy_object): Use build_x_indirect_ref rather
than cp_build_indirect_ref.

From-SVN: r172283

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C [new file with mode: 0644]

index 104005169650a75792d6ed5e8d43e063eea3c730..7a087c52ddc392cd4decf6e1b672a74791d47f7d 100644 (file)
@@ -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.
index d6b6197cbe23e9d4ec33aa98f6b1e4c8363c5069..ad004bba28e7647c5acbaa77bf3f049f935dc2b6 100644 (file)
@@ -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));
index 3812feff89a3ee922412012271ff95f77b65f696..05beba02a41fc84ec29eb84f702113bd28250c08 100644 (file)
@@ -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 (file)
index 0000000..29cd2a9
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/48523
+// { dg-options -std=c++0x }
+
+template<typename>
+struct X
+{
+  bool b;
+
+  void f()
+  {
+    [this]{ return b; };
+  }
+};