diff options
author | Jason Merrill <jason@redhat.com> | 2010-04-27 17:26:25 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-04-27 17:26:25 -0400 |
commit | a684685337dc14afc172c7e2172b40d65dd4fa7b (patch) | |
tree | 29e991f81e1c25904d490958f6de0701b19fd4a6 /gcc/cp/semantics.c | |
parent | 16de17aec71ab79c098ce82ac091f447f272834c (diff) | |
download | gcc-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/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6bf33c7..7c03959 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5869,6 +5869,32 @@ lambda_expr_this_capture (tree lambda) return result; } +/* Returns the method basetype of the innermost non-lambda function, or + NULL_TREE if none. */ + +tree +nonlambda_method_basetype (void) +{ + tree fn, type; + if (!current_class_ref) + return NULL_TREE; + + type = current_class_type; + if (!LAMBDA_TYPE_P (type)) + return type; + + /* Find the nearest enclosing non-lambda function. */ + fn = TYPE_NAME (type); + do + fn = decl_function_context (fn); + while (fn && LAMBDA_FUNCTION_P (fn)); + + if (!fn || !DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + return NULL_TREE; + + return TYPE_METHOD_BASETYPE (TREE_TYPE (fn)); +} + /* If the closure TYPE has a static op(), also add a conversion to function pointer. */ |