* attribute.cs (Resolve): Add error 591 detection.
* class.cs (FieldMember.Define): Add error 1547 detection.
(Indexer.Define): Add error 620 detection.
(Operator.Define): Add error 590 detection.
* ecore.cs: Missing argument for error 79.
* expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
detection.
svn path=/trunk/mcs/; revision=37380
+2004-12-08 Marek Safar <marek.safar@seznam.cz>
+
+ * attribute.cs (Resolve): Add error 591 detection.
+
+ * class.cs (FieldMember.Define): Add error 1547 detection.
+ (Indexer.Define): Add error 620 detection.
+ (Operator.Define): Add error 590 detection.
+
+ * ecore.cs: Missing argument for error 79.
+
+ * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
+ detection.
+
2004-12-07 Marek Safar <marek.safar@seznam.cz>
Fix #70106
if (DoCompares){
if (usage_attr) {
+ if ((int)val == 0) {
+ Report.Error (591, Location, "Invalid value for argument to 'System.AttributeUsage' attribute");
+ return null;
+ }
usage_attribute = new AttributeUsageAttribute ((AttributeTargets)val);
} else if (MethodImplAttr) {
this.ImplOptions = (MethodImplOptions) val;
return true;
}
- protected override bool DoDefine ()
- {
- if (!base.DoDefine ())
- return false;
-
- if (MemberType == TypeManager.void_type) {
- Report.Error (1547, Location,
- "Keyword 'void' cannot be used in this context");
- return false;
- }
- return true;
- }
-
public override string GetSignatureForError ()
{
if (FieldBuilder == null) {
return false;
MemberType = texpr.ResolveType (ec);
+
+ if (MemberType == TypeManager.void_type) {
+ Report.Error (1547, Location, "Keyword 'void' cannot be used in this context");
+ return false;
+ }
+
ec.InUnsafe = old_unsafe;
if (!CheckBase ())
if (!base.Define ())
return false;
+ if (MemberType == TypeManager.void_type) {
+ Report.Error (620, Location, "Indexers cannot have void type");
+ return false;
+ }
+
if (OptAttributes != null) {
Attribute indexer_attr = OptAttributes.Search (TypeManager.indexer_name_type, ec);
if (indexer_attr != null) {
if (!DoDefine ())
return false;
+ if (MemberType == TypeManager.void_type) {
+ Report.Error (590, Location, "User-defined operators cannot return void");
+ return false;
+ }
+
OperatorMethod = new Method (
Parent, Type, ModFlags, false, MemberName,
Parameters, OptAttributes, Location);
public override void Emit (EmitContext ec)
{
if (instance_expr is This)
- Report.Error (79, loc, "The event `{0}' can only appear on the left hand side of += or -=, try calling the actual delegate");
+ Report.Error (79, loc, "The event `{0}' can only appear on the left hand side of += or -=, try calling the actual delegate", Name);
else
Report.Error (70, loc, "The event `{0}' can only appear on the left hand side of += or -= "+
"(except on the defining type)", Name);
UnsafeError (loc);
return null;
}
+
+ if (type.IsArray && (type.GetElementType () == TypeManager.arg_iterator_type ||
+ type.GetElementType () == TypeManager.typed_reference_type)) {
+ Report.Error (611, loc, "Array elements cannot be of type '{0}'", TypeManager.CSharpName (type.GetElementType ()));
+ return null;
+ }
eclass = ExprClass.Type;
return this;
}
if (parameter_type == TypeManager.void_type){
- Report.Error (1536, l, "`void' parameter is not permitted");
+ Report.Error (1536, l, "Invalid parameter type 'void'");
return false;
}