https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70635
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> --- I think we can simply restrict the same_type_p call to type_decls with TREE_TYPE with CLASS_TYPE_P true or something very close. I'm testing a patch.