Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StructInitializer in Mux expressions #2487

Closed
fruffy opened this issue Aug 4, 2020 · 0 comments · Fixed by #2490
Closed

StructInitializer in Mux expressions #2487

fruffy opened this issue Aug 4, 2020 · 0 comments · Fixed by #2490
Assignees
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.

Comments

@fruffy
Copy link
Collaborator

fruffy commented Aug 4, 2020

I have a question about StructInitializers in Mux expressions:

control ingress(inout Headers h) {
    apply {
        h.eth_hdr = h.eth_hdr.eth_type == 1 ? {48w1, 48w1, 16w1} : {48w2, 48w2, 16w2};
    }
}

Is this legal? Currently, I get the error:

mux_validity.p4(29): [--Werror=type-error] error: AssignmentStatement: Cannot unify tuple_0 wi
th ethernet_t                                                                                                 
        h.eth_hdr = h.eth_hdr.eth_type == 1 ? {48w1, 48w1, 16w1} : {48w2, 48w2, 16w2};     

mux_initializer.p4.txt

@mihaibudiu mihaibudiu self-assigned this Aug 4, 2020
@mihaibudiu mihaibudiu added the bug This behavior is unintended and should be fixed. label Aug 4, 2020
@mihaibudiu mihaibudiu added the fixed This topic is considered to be fixed. label Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants