- ec.Report.Error (131, loc, "The left-hand side of an assignment must be a variable, a property or an indexer");
+ if (rhs == EmptyExpression.LValueMemberAccess || rhs == EmptyExpression.LValueMemberOutAccess) {
+ rc.Report.SymbolRelatedToPreviousError (type);
+ if (rc.CurrentInitializerVariable != null) {
+ rc.Report.Error (1918, loc, "Members of value type `{0}' cannot be assigned using a property `{1}' object initializer",
+ type.GetSignatureForError (), GetSignatureForError ());
+ } else {
+ rc.Report.Error (1612, loc, "Cannot modify a value type return value of `{0}'. Consider storing the value in a temporary variable",
+ GetSignatureForError ());
+ }
+ } else {
+ rc.Report.Error (131, loc, "The left-hand side of an assignment must be a variable, a property or an indexer");
+ }