2004-05-24 Anders Carlsson <andersca@gnome.org>
[mono.git] / mcs / mcs / assign.cs
index ec21026574f4b946fd4f3bce41a3f049dc2f945b..ecabbcad46194f8838d8dfdce1f0c6d48cf78016 100755 (executable)
@@ -295,11 +295,19 @@ namespace Mono.CSharp {
                                
                                        //
                                        // 2. and the original right side is implicitly convertible to
-                                       // the type of target_type.
+                                       // the type of target
                                        //
                                        if (Convert.ImplicitStandardConversionExists (a.original_source, target_type))
                                                return this;
 
+                                       //
+                                       // In the spec 2.4 they added: or if type of the target is int
+                                       // and the operator is a shift operator...
+                                       //
+                                       if (source_type == TypeManager.int32_type &&
+                                           (b.Oper == Binary.Operator.LeftShift || b.Oper == Binary.Operator.RightShift))
+                                               return this;
+
                                        Convert.Error_CannotImplicitConversion (loc, a.original_source.Type, target_type);
                                        return null;
                                }
@@ -379,10 +387,8 @@ namespace Mono.CSharp {
                        // 
                        IAssignMethod am = (IAssignMethod) target;
                        
-                       if (this is CompoundAssign){
+                       if (this is CompoundAssign)
                                am.CacheTemporaries (ec);
-                               use_temporaries = true;
-                       }
 
                        if (!is_statement)
                                use_temporaries = true;