@@ -605,6 +605,7 @@ class type : public memento
605605 virtual function_type *as_a_function_type () { gcc_unreachable (); return NULL ; }
606606 virtual struct_ *dyn_cast_struct () { return NULL ; }
607607 virtual vector_type *dyn_cast_vector_type () { return NULL ; }
608+ virtual array_type *dyn_cast_array_type () { return NULL ; }
608609
609610 /* Is it typesafe to copy to this type from rtype? */
610611 virtual bool accepts_writes_from (type *rtype)
@@ -823,6 +824,11 @@ class memento_of_get_const : public decorated_type
823824
824825 void replay_into (replayer *) final override ;
825826
827+ array_type *dyn_cast_array_type () final override
828+ {
829+ return m_other_type->dyn_cast_array_type ();
830+ }
831+
826832private:
827833 string * make_debug_string () final override ;
828834 void write_reproducer (reproducer &r) final override ;
@@ -1001,6 +1007,17 @@ class array_type : public type
10011007
10021008 type *dereference () final override ;
10031009
1010+ bool is_same_type_as (type *other) final override
1011+ {
1012+ array_type *other_array_type = other->dyn_cast_array_type ();
1013+ if (!other_array_type)
1014+ return false ;
1015+ return m_num_elements == other_array_type->m_num_elements
1016+ && m_element_type->is_same_type_as (other_array_type->m_element_type );
1017+ }
1018+
1019+ array_type *dyn_cast_array_type () final override { return this ; }
1020+
10041021 type* copy (context* ctxt) final override
10051022 {
10061023 type* result = new array_type (ctxt, m_loc, m_element_type->copy (ctxt), m_num_elements);
0 commit comments