Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Allow 'ref readonly struct' for 'readonly ref struct' #1536

Closed
gafter opened this issue May 17, 2018 · 2 comments
Closed

Allow 'ref readonly struct' for 'readonly ref struct' #1536

gafter opened this issue May 17, 2018 · 2 comments

Comments

@gafter
Copy link
Member

gafter commented May 17, 2018

@mazhou-msft commented on Thu Mar 01 2018

Version Used:
Visual Studio 2017 27428.0.d15.7

Steps to Reproduce:

  1. Create a C# project for netcoreapp2.1
  2. Write a declaration of a ref struct:
public readonly ref struct S { }

Expected Behavior:
The order of 'ref' and 'readonly' should not matter; I can either use 'readonly ref struct' or 'ref readonly struct' to declare readonly ref-like types.

Actual Behavior:
'ref readonly struct' is not allowed. looks like ref struct is a compound keyword like partial class.


@CyrusNajmabadi commented on Thu Mar 01 2018

This is not a compiler issue, but a request for a change in the language. as such, this should be filed over at dotnet/csharplang. Thanks!


@alrz commented on Thu Mar 01 2018

this is already championed (#946)


@jcouv commented on Fri Mar 02 2018

Thanks for reporting this.
Since this is a known issue, I'll go ahead and close as duplicate. @alrz is close to getting this fix (dotnet/roslyn#23533) into C# 7.3.


@gafter commented on Thu May 17 2018

This was not championed or fixed. What was fixed was the ordering of ref and partial. There is still an issue with the ordering of ref and readonly.

@bondsbw
Copy link

bondsbw commented May 17, 2018

#1530

@stakx
Copy link
Contributor

stakx commented May 23, 2018

I'm happy to close my issue (#1530) in favour of this one although it's perhaps the more general of the two. Has it already been decided that relaxation should occur only with struct declarations (instead of return value type declarations)?

@dotnet dotnet locked and limited conversation to collaborators Dec 3, 2024
@333fred 333fred converted this issue into discussion #8752 Dec 3, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants