* ecore.cs (Expression.Constantity): Add support for turning null
into a constant.
* const.cs (Const.Define): Allow constants to be reference types
as long as the value is Null.
svn path=/trunk/mcs/; revision=34687
+2004-10-04 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (Expression.Constantity): Add support for turning null
+ into a constant.
+
+ * const.cs (Const.Define): Allow constants to be reference types
+ as long as the value is Null.
+
2004-10-04 Juraj Skripsky <js@hotfeet.ch>
* namespace.cs (NamespaceEntry.Using): No matter which warning
while (ttype.IsArray)
ttype = TypeManager.GetElementType (ttype);
- if (!TypeManager.IsBuiltinType (ttype) &&
- (!ttype.IsSubclassOf (TypeManager.enum_type))) {
+ if (!TypeManager.IsBuiltinType (ttype) && (!ttype.IsSubclassOf (TypeManager.enum_type)) && !(Expr is NullLiteral)) {
Report.Error (
-3, Location,
"Constant type is not valid (only system types are allowed)");
Constant e = Constantify (v, real_type);
return new EnumConstant (e, t);
+ } else if (v == null && !TypeManager.IsValueType (t)){
+ return NullLiteral.Null;
} else
throw new Exception ("Unknown type for constant (" + t +
"), details: " + v);