diff --git a/src/script_opt/Expr.cc b/src/script_opt/Expr.cc index 8cc2eefeaf..2f471d3ef5 100644 --- a/src/script_opt/Expr.cc +++ b/src/script_opt/Expr.cc @@ -176,7 +176,6 @@ bool Expr::IsFieldAssignable(const Expr* e) const { case EXPR_RSHIFT: case EXPR_FIELD: case EXPR_HAS_FIELD: - case EXPR_IN: case EXPR_SIZE: return true; @@ -189,6 +188,8 @@ bool Expr::IsFieldAssignable(const Expr* e) const { // case EXPR_NE: // case EXPR_GE: // case EXPR_GT: + // + // case EXPR_IN: // These could be added if we subsetted them to versions for // which we know it's safe to evaluate both operands. Again diff --git a/testing/btest/Baseline/opt.regress-field-assign-in-op/output b/testing/btest/Baseline/opt.regress-field-assign-in-op/output new file mode 100644 index 0000000000..e62f84d154 --- /dev/null +++ b/testing/btest/Baseline/opt.regress-field-assign-in-op/output @@ -0,0 +1,2 @@ +### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. +nope diff --git a/testing/btest/opt/regress-field-assign-in-op.zeek b/testing/btest/opt/regress-field-assign-in-op.zeek new file mode 100644 index 0000000000..63878e63d9 --- /dev/null +++ b/testing/btest/opt/regress-field-assign-in-op.zeek @@ -0,0 +1,21 @@ +# @TEST-DOC: Regression test for assigning a record field to an "in" operation +# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1" +# @TEST-EXEC: zeek -b -O ZAM %INPUT >output +# @TEST-EXEC: btest-diff output + +type r1: record { + is_free: bool; +}; + +type r2: record { + s: string; + ss: string_set; +}; + +event zeek_init() + { + local l1 = r1($is_free = F); + local l2 = r2($s="foo", $ss=set("bar", "bletch")); + l1$is_free = l2$s in l2$ss; + print l1$is_free ? "yep" : "nope"; + }