-O gen-C++ fixes for compatibility with GH-3249 changes

minor -O gen-C++ BTest updates
This commit is contained in:
Vern Paxson 2023-09-01 12:17:38 -07:00
parent 85cd1d69a4
commit 80eed34985
6 changed files with 19 additions and 8 deletions

View file

@ -541,7 +541,9 @@ string CPPCompile::GenAddToExpr(const Expr* e, GenType gt, bool top_level)
if ( t->Tag() == TYPE_VECTOR )
{
if ( same_type(lhs->GetType(), rhs->GetType()) )
auto& rt = rhs->GetType();
if ( IsVector(rt->Tag()) && same_type(lhs->GetType(), rt) )
add_to_func = "vector_vec_append__CPP";
else
add_to_func = "vector_append__CPP";

View file

@ -24,7 +24,8 @@ inline ValPtr vector_append__CPP(VectorValPtr v1, const ValPtr& v2)
// Appends vector v2 to the vector v1.
inline ValPtr vector_vec_append__CPP(VectorValPtr v1, const VectorValPtr& v2)
{
v2->AddTo(v1.get(), false);
if ( ! v2->AddTo(v1.get(), false) )
reporter->CPPRuntimeError("incompatible vector element assignment");
return v1;
}