https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67337
--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Testing obvious fix: diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 342cb93e68b3..a9993f40b94d 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1149,7 +1149,7 @@ write_template_prefix (const tree node) So, for the example above, `Outer<int>::Inner' is represented as a substitution candidate by a TREE_LIST whose purpose is `Outer<int>' and whose value is `Outer<T>::Inner<U>'. */ - if (TYPE_P (context)) + if (context && TYPE_P (context)) substitution = build_tree_list (context, templ); else substitution = templ;