aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-04-27 17:26:25 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-04-27 17:26:25 -0400
commita684685337dc14afc172c7e2172b40d65dd4fa7b (patch)
tree29e991f81e1c25904d490958f6de0701b19fd4a6 /gcc/cp/class.c
parent16de17aec71ab79c098ce82ac091f447f272834c (diff)
downloadgcc-a684685337dc14afc172c7e2172b40d65dd4fa7b.zip
gcc-a684685337dc14afc172c7e2172b40d65dd4fa7b.tar.gz
gcc-a684685337dc14afc172c7e2172b40d65dd4fa7b.tar.bz2
re PR c++/43856 ([C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement)
PR c++/43856 * name-lookup.c (qualify_lookup): Disqualify lambda op(). * class.c (current_nonlambda_class_type): New fn. * semantics.c (nonlambda_method_basetype): New. * cp-tree.h: Declare them. * tree.c (maybe_dummy_object): Handle implicit 'this' capture. From-SVN: r158807
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 07dfb1c..c640af4 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5971,6 +5971,34 @@ currently_open_derived_class (tree t)
return NULL_TREE;
}
+/* Returns the innermost class type which is not a lambda closure type. */
+
+tree
+current_nonlambda_class_type (void)
+{
+ int i;
+
+ /* We start looking from 1 because entry 0 is from global scope,
+ and has no type. */
+ for (i = current_class_depth; i > 0; --i)
+ {
+ tree c;
+ if (i == current_class_depth)
+ c = current_class_type;
+ else
+ {
+ if (current_class_stack[i].hidden)
+ break;
+ c = current_class_stack[i].type;
+ }
+ if (!c)
+ continue;
+ if (!LAMBDA_TYPE_P (c))
+ return c;
+ }
+ return NULL_TREE;
+}
+
/* When entering a class scope, all enclosing class scopes' names with
static meaning (static variables, static functions, types and
enumerators) have to be visible. This recursive function calls