p4c
p4c copied to clipboard
default_action checking against action is too strong for (s){} argument
take:
struct s
{
bit f0;
bit f1;
}
extern bit ext();
control c()
{
bit<2> tt;
action a(in bit v1, in bit v2) { tt = v1++v2; }
action a1(in s v) { tt = v.f0++v.f1; }
table t
{
actions = { a1((s){ ext(), ext()}); }
default_action = a1((s){ ext(), ext()});
}
apply {}
}
This is rejected:
test3.p4(21): [--Werror=type-error] error: StructExpression: argument does not match declaration in actions list: cast
default_action = a1((s){ ext(), ext()});
^^^^^^^^^^^^^^^^^^
test3.p4(20)
actions = { a1((s){ ext(), ext()}); }
^^^^^^^^^^^^^^^^^^
But they are exactly the same arguments.
This is related to https://github.com/p4lang/p4c/issues/3671 and https://github.com/p4lang/p4c/issues/3666
@apinski-cavium Is this issue fixed with the merge of #3675 ?