c++: Fix up REFLECT_BASE comparison
This commit fixes an ICE (Internal Compiler Error) in `cp_tree_equal` when comparing `REFLECT_BASE` nodes in C++ reflection.
This commit resolves an ICE in cp_tree_equal when comparing REFLECT_BASE nodes, which arose from a recent change in reflection handling. When comparing REFLECT_BASE nodes with different TREE_CODE values the compiler would previously crash. This commit fixes this issue by directly comparing the pointers of the REFLECT_BASE nodes, preventing the erroneous call to cp_tree_equal with unexpected input and thus the ICE. A new test case is added to prevent regressions.
In Details
The commit fixes an ICE in cp_tree_equal in reflect.cc when comparing REFLECT_BASE nodes during reflection processing. The issue occurs because cp_tree_equal is not prepared to handle TREE_BINFO nodes, which are used as REFLECT_EXPR_HANDLE for REFLECT_BASE nodes. The fix directly compares the lhs and rhs pointers for REFLECT_BASE nodes, avoiding the problematic call to cp_tree_equal.
For Context
This commit addresses an internal compiler error (ICE) related to C++ reflection, a feature that allows programs to inspect and manipulate their own structure at runtime. The bug occurred when the compiler was comparing base class reflections. The fix ensures that base class reflections are compared correctly, preventing unexpected compiler crashes and improving the reliability of code that uses C++ reflection.