Fix compilation error
[mono.git] / mcs / mcs / constant.cs
index 9ceef13ac9ab0c666e9a925b807fd0debf6076f6..c5a38e79439a419930ac5aaca968989b7cad69db 100644 (file)
@@ -216,6 +216,11 @@ namespace Mono.CSharp {
                public virtual bool IsZeroInteger {
                        get { return false; }
                }
+
+               protected override void CloneTo (CloneContext clonectx, Expression target)
+               {
+                       // CloneTo: Nothing, we do not keep any state on this expression
+               }
        }
 
        public abstract class IntegralConstant : Constant {
@@ -466,14 +471,14 @@ namespace Mono.CSharp {
                        }
                        if (target_type == TypeManager.sbyte_type) {
                                if (inCheckedContext){
-                                       if (Value < SByte.MinValue || Value > SByte.MaxValue)
+                                       if (Value > SByte.MaxValue)
                                                throw new OverflowException ();
                                }
                                return new SByteConstant ((sbyte) Value, Location);
                        }
                        if (target_type == TypeManager.short_type) {
                                if (inCheckedContext){
-                                       if (Value < Int16.MinValue || Value > Int16.MaxValue)
+                                       if (Value > Int16.MaxValue)
                                                throw new OverflowException ();
                                }                                       
                                return new ShortConstant ((short) Value, Location);
@@ -677,7 +682,7 @@ namespace Mono.CSharp {
                                return new DoubleConstant ((double) Value, Location);
                        if (target_type == TypeManager.char_type) {
                                if (inCheckedContext){
-                                       if (Value < Char.MinValue && Value > Char.MaxValue)
+                                       if (Value < Char.MinValue)
                                                throw new OverflowException ();
                                }
                                return new CharConstant ((char) Value, Location);