Author: martin
Date: 2006-03-23 11:06:40 -0500 (Thu, 23 Mar 2006)
New Revision: 58363

Added:
   trunk/mcs/errors/gcs0030.cs
Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/convert.cs
Log:
2006-03-23  Martin Baulig  <[EMAIL PROTECTED]>

        * convert.cs (Convert.ImplicitTypeParameterConversion): Do not
        blindly allow all conversions if we do not have any constraints.



Added: trunk/mcs/errors/gcs0030.cs
===================================================================
--- trunk/mcs/errors/gcs0030.cs 2006-03-23 15:31:01 UTC (rev 58362)
+++ trunk/mcs/errors/gcs0030.cs 2006-03-23 16:06:40 UTC (rev 58363)
@@ -0,0 +1,16 @@
+// CS0030: Cannot convert type `T' to `X'.
+// Line: 8
+class Foo<T>
+       where T : System.ICloneable
+{
+       public X Test (T t)
+       {
+               return (X) t;
+       }
+}
+
+class X
+{
+       static void Main ()
+       { }
+}


Property changes on: trunk/mcs/errors/gcs0030.cs
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2006-03-23 15:31:01 UTC (rev 58362)
+++ trunk/mcs/gmcs/ChangeLog    2006-03-23 16:06:40 UTC (rev 58363)
@@ -1,3 +1,8 @@
+2006-03-23  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * convert.cs (Convert.ImplicitTypeParameterConversion): Do not
+       blindly allow all conversions if we do not have any constraints.
+
 2006-02-27  Marek Safar  <[EMAIL PROTECTED]>
 
        * attribute.cs (Attribute.PosArguments, Attribute.NamedArguments): Use

Modified: trunk/mcs/gmcs/convert.cs
===================================================================
--- trunk/mcs/gmcs/convert.cs   2006-03-23 15:31:01 UTC (rev 58362)
+++ trunk/mcs/gmcs/convert.cs   2006-03-23 16:06:40 UTC (rev 58363)
@@ -86,10 +86,6 @@
                                return null;
                        }
 
-                       if (!gc.HasClassConstraint && 
!gc.HasConstructorConstraint && !gc.HasReferenceTypeConstraint &&
-                               !gc.HasValueTypeConstraint)
-                               return new ClassCast (expr, target_type);
-
                        // We're converting from a type parameter which is 
known to be a reference type.
                        Type base_type = TypeParam_EffectiveBaseType (gc);
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to