Author: zoltan
Date: 2006-01-19 07:10:05 -0500 (Thu, 19 Jan 2006)
New Revision: 55776

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/marshal.c
Log:
2006-01-19  Zoltan Varga  <[EMAIL PROTECTED]>

        * marshal.c (emit_struct_conv): Relax the fields with same offset
        check even more. Fixes #77230.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2006-01-19 11:43:51 UTC (rev 55775)
+++ trunk/mono/mono/metadata/ChangeLog  2006-01-19 12:10:05 UTC (rev 55776)
@@ -1,3 +1,8 @@
+2006-01-19  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * marshal.c (emit_struct_conv): Relax the fields with same offset
+       check even more. Fixes #77230.
+
 2006-01-18  Martin Baulig  <[EMAIL PROTECTED]>
 
        * loader.c (find_method_in_class): Added `gboolean is_inflated'

Modified: trunk/mono/mono/metadata/marshal.c
===================================================================
--- trunk/mono/mono/metadata/marshal.c  2006-01-19 11:43:51 UTC (rev 55775)
+++ trunk/mono/mono/metadata/marshal.c  2006-01-19 12:10:05 UTC (rev 55776)
@@ -1349,8 +1349,10 @@
                 * FIXME: Should really check for usize==0 and msize>0, but we 
apply 
                 * the layout to the managed structure as well.
                 */
-               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == 
TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) && (usize == 0) && !to_object)
-                       g_error ("Type %s which has an [ExplicitLayout] 
attribute cannot have two fields with the same offset.", mono_type_full_name 
(&klass->byval_arg));
+               if (((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == 
TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) && (usize == 0)) {
+                       if (MONO_TYPE_IS_REFERENCE (info->fields 
[i].field->type) || ((!last_field && MONO_TYPE_IS_REFERENCE (info->fields [i + 
1].field->type))))
+                       g_error ("Type %s which has an [ExplicitLayout] 
attribute cannot have a reference field at the same offset as another field.", 
mono_type_full_name (&klass->byval_arg));
+               }
 
                if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == 
TYPE_ATTRIBUTE_AUTO_LAYOUT)
                        g_error ("Type %s which is passed to unmanaged code 
must have a StructLayout attribute", mono_type_full_name (&klass->byval_arg));

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

Reply via email to