name-lookup.c (pushdecl_maybe_friend_1): Use nonlambda_method_basetype and current_no...
authorJason Merrill <jason@redhat.com>
Thu, 28 Mar 2013 18:20:37 +0000 (14:20 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 28 Mar 2013 18:20:37 +0000 (14:20 -0400)
* name-lookup.c (pushdecl_maybe_friend_1): Use
nonlambda_method_basetype and current_nonlambda_class_type.

From-SVN: r197210

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

index 164c79700cac706cc51e5d88dda44281f5d1a280..b20415391f7205df7ab45f356897ddab7e6dea67 100644 (file)
@@ -1,5 +1,8 @@
 2013-03-28  Jason Merrill  <jason@redhat.com>
 
+       * name-lookup.c (pushdecl_maybe_friend_1): Use
+       nonlambda_method_basetype and current_nonlambda_class_type.
+
        PR c++/56728
        * semantics.c (potential_constant_expression_1) [NOP_EXPR]: Reject
        conversion from integer to pointer.
index 0a0915af8a9118feedeb058088a8058162dcc589..e2ef75bac23abdc3f1eb4ce5cb4e024f0bc8a4b3 100644 (file)
@@ -1163,8 +1163,8 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
            {
              tree member;
 
-             if (current_class_ptr)
-               member = lookup_member (current_class_type,
+             if (nonlambda_method_basetype ())
+               member = lookup_member (current_nonlambda_class_type (),
                                        name,
                                        /*protect=*/0,
                                        /*want_type=*/false,
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow2.C
new file mode 100644 (file)
index 0000000..8237a81
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-options "-std=c++11 -Wshadow" }
+
+struct A
+{
+  int i;
+  void f()
+  {
+    [=]{ int i; };             // { dg-warning "shadows" }
+  }
+};