Skip to content

Commit 808dade

Browse files
committed
Provide suitable diagnostics for equality-without-matching-types
1 parent 89cf6fe commit 808dade

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/solvers/flattening/boolbv_equality.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ Author: Daniel Kroening, [email protected]
1212
#include <util/base_type.h>
1313
#include <util/invariant.h>
1414

15+
#include "bv_conversion_exceptions.h"
1516
#include "flatten_byte_operators.h"
1617

1718
literalt boolbvt::convert_equality(const equal_exprt &expr)
1819
{
1920
const bool is_base_type_eq =
2021
base_type_eq(expr.lhs().type(), expr.rhs().type(), ns);
21-
DATA_INVARIANT(
22-
is_base_type_eq,
23-
std::string("equality without matching types:\n") + "######### lhs: " +
24-
expr.lhs().pretty() + '\n' + "######### rhs: " + expr.rhs().pretty());
22+
if(!is_base_type_eq)
23+
{
24+
const std::string error_msg =
25+
std::string("equality without matching types:\n") + "######### lhs: " +
26+
expr.lhs().pretty() + '\n' + "######### rhs: " + expr.rhs().pretty();
27+
throw bitvector_conversion_exceptiont(error_msg, expr);
28+
}
2529

2630
// see if it is an unbounded array
2731
if(is_unbounded_array(expr.lhs().type()))

0 commit comments

Comments
 (0)