C: prevent from casting to native function type

This commit is contained in:
Alexey Andreev 2021-08-31 15:11:17 +03:00
parent ada2bf9c58
commit 08aa642fe5

View File

@ -1058,8 +1058,7 @@ public class CodeGenerationVisitor implements ExprVisitor, StatementVisitor {
public void visit(CastExpr expr) { public void visit(CastExpr expr) {
if (expr.getTarget() instanceof ValueType.Object) { if (expr.getTarget() instanceof ValueType.Object) {
String className = ((ValueType.Object) expr.getTarget()).getClassName(); String className = ((ValueType.Object) expr.getTarget()).getClassName();
if (context.getCharacteristics().isStructure(className) if (!context.getCharacteristics().isManaged(className)) {
|| className.equals(Address.class.getName())) {
expr.getValue().acceptVisitor(this); expr.getValue().acceptVisitor(this);
return; return;
} }