diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-29 19:40:13 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-29 19:40:13 +0000 |
commit | f7b5b4ed3295779d359879a83758cdf7a8d19d80 (patch) | |
tree | 7c729aadab74419596d84d5cc8d3c2937438fed8 /gcc/cp/mangle.c | |
parent | 16e3c896e49b2367cda49b2e875ce05c84a98383 (diff) | |
download | gcc-f7b5b4ed3295779d359879a83758cdf7a8d19d80.tar.gz |
* mangle.c (write_name): Check for null context.
(write_unscoped_name): Allow PARM_DECL context.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201317 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r-- | gcc/cp/mangle.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 68b956bbbd1..3cfca583cb0 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -798,13 +798,14 @@ write_name (tree decl, const int ignore_local_scope) context = decl_mangling_context (decl); + gcc_assert (context != NULL_TREE); + /* A decl in :: or ::std scope is treated specially. The former is mangled using <unscoped-name> or <unscoped-template-name>, the latter with a special substitution. Also, a name that is directly in a local function scope is also mangled with <unscoped-name> rather than a full <nested-name>. */ - if (context == NULL - || context == global_namespace + if (context == global_namespace || DECL_NAMESPACE_STD_P (context) || (ignore_local_scope && (TREE_CODE (context) == FUNCTION_DECL @@ -837,10 +838,10 @@ write_name (tree decl, const int ignore_local_scope) directly in that function's scope, either decl or one of its enclosing scopes. */ tree local_entity = decl; - while (context != NULL && context != global_namespace) + while (context != global_namespace) { /* Make sure we're always dealing with decls. */ - if (context != NULL && TYPE_P (context)) + if (TYPE_P (context)) context = TYPE_NAME (context); /* Is this a function? */ if (TREE_CODE (context) == FUNCTION_DECL @@ -883,9 +884,10 @@ write_unscoped_name (const tree decl) else { /* If not, it should be either in the global namespace, or directly - in a local function scope. */ + in a local function scope. A lambda can also be mangled in the + scope of a default argument. */ gcc_assert (context == global_namespace - || context != NULL + || TREE_CODE (context) == PARM_DECL || TREE_CODE (context) == FUNCTION_DECL); write_unqualified_name (decl); |