aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/mangle.cc')
-rw-r--r--gcc/cp/mangle.cc28
1 files changed, 9 insertions, 19 deletions
diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 02129c6..13d5ded 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -1048,6 +1048,12 @@ decl_mangling_context (tree decl)
tree extra = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (decl));
if (extra)
return extra;
+ tcontext = CP_DECL_CONTEXT (decl);
+ if (LAMBDA_TYPE_P (tcontext))
+ /* Lambda type context means this lambda appears between the
+ lambda-introducer and the open brace of another lambda (c++/119175).
+ That isn't a real scope; look further into the enclosing scope. */
+ return decl_mangling_context (TYPE_NAME (tcontext));
}
else if (template_type_parameter_p (decl))
/* template type parms have no mangling context. */
@@ -4446,23 +4452,12 @@ static tree
mangle_decl_string (const tree decl)
{
tree result;
- tree saved_fn = NULL_TREE;
- bool template_p = false;
+ tree saved_fn = current_function_decl;
/* We shouldn't be trying to mangle an uninstantiated template. */
gcc_assert (!type_dependent_expression_p (decl));
- if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
- {
- struct tinst_level *tl = current_instantiation ();
- if ((!tl || tl->maybe_get_node () != decl)
- && push_tinst_level (decl))
- {
- template_p = true;
- saved_fn = current_function_decl;
- current_function_decl = NULL_TREE;
- }
- }
+ current_function_decl = NULL_TREE;
iloc_sentinel ils (DECL_SOURCE_LOCATION (decl));
start_mangling (decl);
@@ -4477,12 +4472,7 @@ mangle_decl_string (const tree decl)
fprintf (stderr, "mangle_decl_string = '%s'\n\n",
IDENTIFIER_POINTER (result));
- if (template_p)
- {
- pop_tinst_level ();
- current_function_decl = saved_fn;
- }
-
+ current_function_decl = saved_fn;
return result;
}