[Mono-bugs] [Bug 75848][Blo] Changed - mcs fails to generate initialization code for fields whose value is a boxed value type

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 25 20:29:07 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by carlos at unixmexico.org.

http://bugzilla.ximian.com/show_bug.cgi?id=75848

--- shadow/75848	2005-08-25 20:13:14.000000000 -0400
+++ shadow/75848.tmp.10278	2005-08-25 20:29:07.000000000 -0400
@@ -69,6 +69,21 @@
 
 
 ------- Additional Comments From carlos at unixmexico.org  2005-08-25 20:13 -------
 Created an attachment (id=15637)
 Proposed patch
 
+
+------- Additional Comments From carlos at unixmexico.org  2005-08-25 20:29 -------
+I think we can't do the things you mention. Imagine you have
+
+ long LongVar = 0;
+
+Since 'long' and 'int' are not the same type, this initialization
+would be added in the .cctor. The same with other numerical types.
+
+I think this is a special case, and that only matters to cases where a
+boxing appears. We could need to test if the var type is class
+(IsClass) _and_ the var value is value type (IsValueType). I think
+this is better (and it's the logical idea: when boxing, which is
+assigning a value type to a class type, emit initializer even if the
+var value is a default constant).


More information about the mono-bugs mailing list