Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/util/std_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,12 @@ class array_typet:public type_with_subtypet
}
};

template <>
inline bool can_cast_type<array_typet>(const typet &type)
{
return type.id() == ID_array;
}

/*! \brief Cast a generic typet to an \ref array_typet
*
* This is an unchecked conversion. \a type must be known to be \ref
Expand All @@ -1053,7 +1059,7 @@ class array_typet:public type_with_subtypet
*/
inline const array_typet &to_array_type(const typet &type)
{
PRECONDITION(type.id()==ID_array);
PRECONDITION(can_cast_type<array_typet>(type));
return static_cast<const array_typet &>(type);
}

Expand All @@ -1062,7 +1068,7 @@ inline const array_typet &to_array_type(const typet &type)
*/
inline array_typet &to_array_type(typet &type)
{
PRECONDITION(type.id()==ID_array);
PRECONDITION(can_cast_type<array_typet>(type));
return static_cast<array_typet &>(type);
}

Expand Down