diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-30 03:01:30 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-30 03:01:30 +0000 |
commit | a8b750816ddebe7302b52551d9cb745e77d95152 (patch) | |
tree | a0717adf99d475ef98d9002044972a7ab9c3e5d6 /gcc/cp/name-lookup.c | |
parent | 8f1349db3b1bf2be744c127d358f63996eb31f41 (diff) | |
download | gcc-a8b750816ddebe7302b52551d9cb745e77d95152.tar.gz |
merge in cxx0x-lambdas-branch@152308
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152318 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index d37cf44d2d8..459e7390805 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1834,6 +1834,23 @@ make_anon_name (void) return get_identifier (buf); } +/* This code is practically identical to that for creating + anonymous names, but is just used for lambdas instead. This is necessary + because anonymous names are recognized and cannot be passed to template + functions. */ +/* FIXME is this still necessary? */ + +static GTY(()) int lambda_cnt = 0; + +tree +make_lambda_name (void) +{ + char buf[32]; + + sprintf (buf, LAMBDANAME_FORMAT, lambda_cnt++); + return get_identifier (buf); +} + /* Return (from the stack of) the BINDING, if any, established at SCOPE. */ static inline cxx_binding * @@ -2637,6 +2654,11 @@ pushdecl_class_level (tree x) tree name; bool is_valid = true; + /* Do nothing if we're adding to an outer lambda closure type, + outer_binding will add it later if it's needed. */ + if (current_class_type != class_binding_level->this_entity) + return true; + timevar_push (TV_NAME_LOOKUP); /* Get the name of X. */ if (TREE_CODE (x) == OVERLOAD) @@ -3735,6 +3757,11 @@ qualify_lookup (tree val, int flags) return true; if (flags & (LOOKUP_PREFER_NAMESPACES | LOOKUP_PREFER_TYPES)) return false; + /* In unevaluated context, look past capture fields. */ + /* FIXME this will cause trouble with the initializer extension. */ + if (cp_unevaluated_operand && TREE_CODE (val) == FIELD_DECL + && LAMBDA_TYPE_P (DECL_CONTEXT (val))) + return false; return true; } @@ -5114,7 +5141,8 @@ pushtag (tree name, tree type, tag_scope scope) { tree cs = current_scope (); - if (scope == ts_current) + if (scope == ts_current + || (cs && TREE_CODE (cs) == FUNCTION_DECL)) context = cs; else if (cs != NULL_TREE && TYPE_P (cs)) /* When declaring a friend class of a local class, we want |