On April 16, 2019 6:14:45 PM GMT+02:00, Jakub Jelinek <ja...@redhat.com> wrote: >On Tue, Apr 16, 2019 at 04:10:11PM +0000, Michael Matz wrote: >> I was quickly testing also with some early-outs but didn't get >conclusive >> performance results (but really only superficial testing) so I'm not >> proposing it, like so: >> >> diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c >> index 7045284..33f56f9 100644 >> --- a/gcc/cp/typeck.c >> +++ b/gcc/cp/typeck.c >> @@ -1508,6 +1508,10 @@ same_type_ignoring_top_level_qualifiers_p >(tree >> if (type1 == error_mark_node || type2 == error_mark_node) >> return false; >> >> + if (type1 == type2) >> + return true; >> + if (TYPE_MAIN_VARIANT (type1) != TYPE_MAIN_VARIANT (type2)) >> + return false; > >Is this second one correct though? Doesn't comptypes return for >various >cases true even if the TYPE_MAIN_VARIANT is different?
I think it is not equivalent. I thought about adding a flag to comptypes to ignore toplevel qualifiers on-the-fly. Richard. >> type1 = cp_build_qualified_type (type1, TYPE_UNQUALIFIED); >> type2 = cp_build_qualified_type (type2, TYPE_UNQUALIFIED); > > Jakub