--- /dev/null
+// CS0029: Cannot implicitly convert type `T' to `int*'
+// Line : 8
+// Compiler options: -unsafe
+
+class T {
+ static unsafe void Main ()
+ {
+ int *a = (T) null;
+ }
+}
+2007-01-17 Raja R Harinath <rharinath@novell.com>
+
+ Fix cs0029-6.cs and gcs0029-2.cs (regression)
+ * ecore.cs (EmptyConstantCast.ConvertImplicitly): Check that
+ there's an implicit conversion from the current type to the target
+ type before converting the underlying constant.
+
2007-01-16 Marek Safar <marek.safar@gmail.com>
* const.cs (ResolveValue): Updated after constant conversion was made more
public override Constant ConvertExplicitly (bool inCheckedContext, Type target_type)
{
+ // FIXME: check that 'type' can be converted to 'target_type' first
return child.ConvertExplicitly (inCheckedContext, target_type);
}
return child.Increment ();
}
- public override bool IsDefaultValue
- {
+ public override bool IsDefaultValue {
get { return child.IsDefaultValue; }
}
- public override bool IsNegative
- {
+ public override bool IsNegative {
get { return child.IsNegative; }
}
child.Emit (ec);
}
- public override Constant ConvertImplicitly (Type type)
+ public override Constant ConvertImplicitly (Type target_type)
{
- return child.ConvertImplicitly (type);
+ // FIXME: Do we need to check user conversions?
+ if (!Convert.ImplicitStandardConversionExists (this, target_type))
+ return null;
+ return child.ConvertImplicitly (target_type);
}
}