c++/reflection: fixes for comparing reflections [PR125208]
This fixes two bugs:
1) crash in cp_tree_equal when comparing reflections with binfos;
cp_tree_equal doesn't handle those. We're coming from
lookup_template_class -> spec_hasher::equal -> comp_template_args
-> cp_tree_equal. We should use compare_reflections in cp_tree_equal.
2) the fix for 1) revealed that compare_reflections is buggy when
comparing two aliases: we shouldn't fall back to same_type_p
because given
using A = int;
using B = int;
^^A != ^^B should hold.
PR c++/125208
gcc/cp/ChangeLog:
* reflect.cc (compare_reflections): Use == when comparing two
aliases.
* tree.cc (cp_tree_equal) <case REFLECT_EXPR>: Use
compare_reflections.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/alias3.C: New test.
* g++.dg/reflect/bases_of5.C: New test.