This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[c++] Question about "write_unscoped_name (const tree decl)"
- From: Alexander Ivchenko <aivchenk at gmail dot com>
- To: gcc <gcc at gcc dot gnu dot org>, jason at redhat dot com, paolo dot carlini at oracle dot com
- Date: Mon, 29 Jul 2013 14:26:03 +0400
- Subject: [c++] Question about "write_unscoped_name (const tree decl)"
Hi,
In gcc/cp/mangle.c (write_unscoped_name) we have:
/* If not, it should be either in the global namespace, or directly
in a local function scope. */
gcc_assert (context == global_namespace
|| context != NULL
|| TREE_CODE (context) == FUNCTION_DECL);
Which doesn't look like a thought-out assert: e.g. TREE_CODE (context)
will segfault when context==NULL.
According to the comment before the assert supposed to look more like:
gcc_assert (context == global_namespace
|| (context != NULL
&& TREE_CODE (context) == FUNCTION_DECL));
But it gives us an ICE with g++.dg/cpp0x/lambda/lambda-defarg3.C
BTW: First the check was "|| context == NULL", then it was removed by
r149964 and then came back as "|| context != NULL" by r153768.
May be I am missing something here? Could somebody clarify that peace
of code please.
--Alexander