This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]