}
if (MemberType.Kind == MemberKind.ByRef) {
- Report.Error (8145, Location, "Auto-implemented properties cannot return by reference");
+ Report.Error (8145, Location, "Auto-implemented property `{0}' cannot return by reference",
+ GetSignatureForError ());
return false;
}
+ if ((Parent.PartialContainer.ModFlags & Modifiers.READONLY) != 0 && Set != null && !IsStatic) {
+ Report.Error (8341, Location, "Auto-implemented instance property `{0}' in readonly structs must be readonly",
+ GetSignatureForError ());
+ }
+
if (Compiler.Settings.Version < LanguageVersion.V_3 && Initializer == null)
Report.FeatureIsNotAvailable (Compiler, Location, "auto-implemented properties");
base.ApplyAttributeBuilder (a, ctor, cdata, pa);
}
+ protected override void DoMemberTypeIndependentChecks ()
+ {
+ if ((Parent.PartialContainer.ModFlags & Modifiers.READONLY) != 0 && (ModFlags & Modifiers.STATIC) == 0) {
+ Report.Error (8342, Location, "`{0}': Field-like instance events are not allowed in readonly structs",
+ GetSignatureForError ());
+ }
+
+ base.DoMemberTypeIndependentChecks ();
+ }
+
public override bool Define()
{
var mod_flags_src = ModFlags;