Initial import of the Generic MCS tree.
[mono.git] / mcs / gmcs / expression.cs
index 50f367fe34b7a6b9b5c2f4938c09c106a6cf8b63..3c29a1d3157d9ac1650336a129b780dd5f578a57 100755 (executable)
@@ -6379,7 +6379,7 @@ namespace Mono.CSharp {
        ///   Implements the sizeof expression
        /// </summary>
        public class SizeOf : Expression {
-               public readonly Expression QueriedType;
+               public Expression QueriedType;
                Type type_queried;
                
                public SizeOf (Expression queried_type, Location l)
@@ -6397,10 +6397,15 @@ namespace Mono.CSharp {
                                return null;
                        }
                                
-                       type_queried = ec.DeclSpace.ResolveType (QueriedType, false, loc);
-                       if (type_queried == null)
+                       QueriedType = ec.DeclSpace.ResolveTypeExpr (QueriedType, false, loc);
+                       if (QueriedType == null || QueriedType.Type == null)
                                return null;
 
+                       if (QueriedType is TypeParameterExpr){
+                               ((TypeParameterExpr)QueriedType).Error_CannotUseAsUnmanagedType (loc);
+                               return null;
+                       }
+                       
                        if (!TypeManager.IsUnmanagedType (type_queried)){
                                Report.Error (208, loc, "Cannot take the size of an unmanaged type (" + TypeManager.CSharpName (type_queried) + ")");
                                return null;