https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117782
--- Comment #2 from kugan at gcc dot gnu.org --- --- a/gcc/cp/mangle.cc +++ b/gcc/cp/mangle.cc @@ -1194,6 +1194,7 @@ write_unscoped_name (const tree decl) in a local function scope. A lambda can also be mangled in the scope of a default argument. */ gcc_assert (context == global_namespace + || TREE_CODE (context) == RECORD_TYPE || TREE_CODE (context) == PARM_DECL || TREE_CODE (context) == FUNCTION_DECL); Fixes.