if (expr == null)
return null;
- if (probe_type_expr.Type == TypeManager.void_type) {
- // TODO: Void is missing location (ProbeType.Location)
- Error_VoidInvalidInTheContext (Location);
- return null;
- }
-
if ((probe_type_expr.Type.Attributes & Class.StaticClassAttribute) == Class.StaticClassAttribute) {
Report.Error (-244, loc, "The `{0}' operator cannot be applied to an operand of a static type",
OperatorName);
this.target_type = cast_type;
this.expr = expr;
this.loc = loc;
-
- if (target_type == TypeManager.system_void_expr)
- Error_VoidInvalidInTheContext (loc);
}
public Expression TargetType {
type = texpr.Type;
- if (type == TypeManager.void_type) {
- Error_VoidInvalidInTheContext (loc);
- return null;
+ if ((type.Attributes & Class.StaticClassAttribute) == Class.StaticClassAttribute) {
+ Report.Error (-244, loc, "The `default value' operator cannot be applied to an operand of a static type");
}
+ if (type.IsPointer)
+ return new NullLiteral (Location).ConvertImplicitly (type);
+
if (TypeManager.IsReferenceType (type)) {
return new EmptyConstantCast (new NullLiteral (Location), type);
type = texpr.Type;
- if (type == TypeManager.void_type) {
- Error_VoidInvalidInTheContext (loc);
- return null;
- }
-
if (type.IsPointer) {
Report.Error (1919, loc, "Unsafe type `{0}' cannot be used in an object creation expression",
TypeManager.CSharpName (type));
Report.Error (622, loc, "Can only use array initializer expressions to assign to array types. Try using a new expression instead");
return false;
}
+
+ if (requested_base_type is VarExpr) {
+ Report.Error (820, loc, "An implicitly typed local variable declarator cannot use an array initializer");
+ return false;
+ }
StringBuilder array_qualifier = new StringBuilder (rank);
if (TypeManager.IsEnumType (type_queried))
type_queried = TypeManager.GetEnumUnderlyingType (type_queried);
- if (type_queried == TypeManager.void_type) {
- Expression.Error_VoidInvalidInTheContext (loc);
- return null;
- }
-
int size_of = GetTypeSize (type_queried);
if (size_of > 0) {
return new IntConstant (size_of, loc);
return null;
Type ltype = lexpr.Type;
- if ((ltype == TypeManager.void_type) && (dim != "*")) {
- Error_VoidInvalidInTheContext (loc);
- return null;
- }
-
#if GMCS_SOURCE
if ((dim.Length > 0) && (dim [0] == '?')) {
TypeExpr nullable = new Nullable.NullableType (left, loc);
return null;
if (dim.Length != 0 && dim [0] == '[') {
- if (ltype == TypeManager.arg_iterator_type || ltype == TypeManager.typed_reference_type) {
+ if (TypeManager.IsSpecialType (ltype)) {
Report.Error (611, loc, "Array elements cannot be of type `{0}'", TypeManager.CSharpName (ltype));
return null;
}