-
Notifications
You must be signed in to change notification settings - Fork 446
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
const not allowed inside parser state definition #422
Comments
Actually variable declarations at the top-level should be illegal. If they are not, it's a bug. |
I could not reproduce the claim that variable declarations are allowed at the top-level. If you have a counter-example please share it. Please note that we make a clear distinction between variables and instances. Variables live on the "stack", while instances are statically allocated. We allow instances at the top-level, but not variables. |
I was mistaken about variable declarations being allowed at the top-level. Thanks for the correction. |
Github did not auto-close this issue when the commit to fix it went in: b85401c I have tested with compiler and failing test case after that commit, and it is accepting const inside parser state definition now, so closing. |
The attached program demonstrates this with 2017-Mar-30 version of p4test and p4c-bm2-ss.
Both const and variable declarations are allowed in all of these places by current P4_16 compiler:
The unusual one is that parser states allow variable declarations, but not const. Not a hard restriction to live with, but seems fairly odd given the consistency in all of the other places above.
const-error-in-state.p4.txt
The text was updated successfully, but these errors were encountered: