-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Restored requirement for struct constructors to always have formal param... #1052
Conversation
…rameters (C#) Issue dotnet#1029 While overall parameterless constructors in structs are valid from IL perspective, without a convenient way to declare them they were virtually nonexistent. As we performed more and more testing, we kept discovering cases where parameterless struct constructors caused inconsistent behavior in libraries or even in some versions of CLR. After reconsidering the potential issues arising from breaking long standing assumptions, we decided it was best for our users to restore the requirement on struct constructors to always have formal parameters.
@gafter @AlekseyTs |
@@ -101,7 +101,7 @@ internal enum MessageID | |||
// IDS_VersionExperimental = MessageBase + 12694, | |||
IDS_FeatureNameof = MessageBase + 12695, | |||
IDS_FeatureDictionaryInitializer = MessageBase + 12696, | |||
IDS_FeatureStructParameterlessConstructors = MessageBase + 12697, | |||
// IDS_FeatureStructParameterlessConstructors = MessageBase + 12697, |
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.
We should probably remove this and mark the number for reuse.
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.
Remove corresponding string from resources?
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.
Agreed
Looks good to me, modulo two small changes suggested by @AlekseyTs |
LGTM under the same conditions. |
This was submitted together with corresponding VB changes. |
...eters (C#)
Issue #1029
While overall parameterless constructors in structs are valid from IL perspective, without a convenient way to declare them they were virtually nonexistent. As we performed more and more testing, we kept discovering cases where parameterless struct constructors caused inconsistent behavior in libraries or even in some versions of CLR.
After reconsidering the potential issues arising from breaking long standing assumptions, we decided it was best for our users to restore the requirement on struct constructors to always have formal parameters.