https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71832
Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paolo.carlini at oracle dot com --- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> --- Avoiding the ICE seems easy, something like the below but the diagnostic we produce is way too redundant. I believe that in such cases we should skip completely the body of the template (A). Index: class.c =================================================================== --- class.c (revision 258250) +++ class.c (working copy) @@ -7568,6 +7568,9 @@ push_nested_class (tree type) void pop_nested_class (void) { + if (!current_class_type) + return; + tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type)); popclass ();