You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make two changes to cover property accessors in structs and the `readonly` modifier.
First, in expressions, add a note that property accessors are classified as function member access: A property access invokes the corresponding function member. So, the same rules apply.
Second, in structs differences, add that accessing a non-readonly setter when that requires creating a temporary is a compile-time error. In the case of a getter, the temporary is created if the getter is not classified as `readonly`.
- If `E` isnotclassifiedasavariable, orif `V` isnotareadonlystructtype ([§16.2.2](structs.md#1622-struct-modifiers)) andthedeclarationof`M` doesnotincludethe `readonly` modifier (§16.4.12), and `E` isoneof:
1226
+
- If `E` isnotclassifiedasavariable, orif `V` isnotareadonlystructtype ([§16.2.2](structs.md#1622-struct-modifiers)) and `M` isnotareadonlyfunctionmember (§16.4.12), and `E` isoneof:
1227
1227
-aninputparameter ([§15.6.2.3.2](classes.md#156232-input-parameters)), or
1228
1228
-a `readonly` field ([§15.5.3](classes.md#1553-readonly-fields)), or
1229
1229
-a `readonly` referencevariableorreturn ([§9.7](variables.md#97-reference-variables-and-returns)),
> *Note*: Thisaccessrestrictionmeansthatconstructorsinstructscontainingautomaticallyimplementedpropertiesoftenneedanexplicitconstructorinitializer where they would not otherwise need one, to satisfy the requirement of all fields being definitely assigned before any function member is invoked or the constructor returns. *end note*
0 commit comments