Compare ARRAY_REF and COMPONENT_REF using cp_tree_equal

This commit is contained in:
Marek Polacek
2026-01-13 20:03:12 -05:00
parent 79f1e91cc9
commit 5bc0ec8129
2 changed files with 2 additions and 4 deletions

View File

@@ -8276,10 +8276,6 @@ compare_reflections (tree lhs, tree rhs)
{
case ARRAY_REF:
case COMPONENT_REF:
return (TREE_TYPE (lhs) == TREE_TYPE (rhs)
&& TREE_OPERAND (lhs, 0) == TREE_OPERAND (rhs, 0)
&& TREE_OPERAND (lhs, 1) == TREE_OPERAND (rhs, 1)
&& TREE_OPERAND (lhs, 2) == TREE_OPERAND (rhs, 2));
case REAL_CST:
return cp_tree_equal (lhs, rhs);
default:

View File

@@ -11,6 +11,8 @@ struct S { int m; };
template <int &> void fn();
int p[2];
static_assert(template_arguments_of(^^fn<p[1]>)[0] == reflect_object(p[1]));
int pp[2][2];
static_assert(template_arguments_of(^^fn<pp[1][1]>)[0] == reflect_object(pp[1][1]));
template <const int &P>
void