-
Notifications
You must be signed in to change notification settings - Fork 88
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
Remove constraints on stackalloc (support new locations) #1211
Remove constraints on stackalloc (support new locations) #1211
Conversation
This change reflects the following behavior. This is illegal:
Because a stackalloc expression used as an initializer is of type T* (an unsafe pointer type) which requires an unsafe context. However, these are legal:
and
(Note the addition of parens) |
I don't understand the following behavior: This is illegal:
I don't understand why. Perhaps because `nint[3] is parsed as a type. I get the error
Yet this is legal:
|
Is this intended to replace or be related to #604? I can't quite get my head round it all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. We should discuss the general comments.
I think that's correct. It's trying to stackalloc an array of 1 where the element is
This surprises me as well. I think this should be illegal as well. According to sharplab, the type is |
Because this |
According to the v7 grammar it is not illegal and parses as an element_access of a stackalloc_expression. Note that the syntactically very similar The parenthesised version |
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Bill Wagner <[email protected]>
No description provided.