Bugzilla – Bug 323004
[PATCH] Implicit casts not considered with compound assignments
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by martin.voelkle@gmail.com 2006-12-19 08:31:22 MST ---- Description of Problem: Similar to https://bugzilla.novell.com/show_bug.cgi?id=MONO80288: using System; namespace Bugs { class https://bugzilla.novell.com/show_bug.cgi?id=MONO1 { struct MyInt { private int value; public MyInt(int value) { this.value = value; } public static implicit operator MyInt(int value) { return new MyInt(value); } public static implicit operator int(MyInt b) { return b.value; } } public static void Main(string[] args) { MyInt i = 3; i &= (4 + i); Console.WriteLine(i); } } } Assignment "i &= (4 + i)" fails although (i & (4 + i)) is implicitely convertible to MyInt. ---- Additional Comments From martin.voelkle@gmail.com 2006-12-19 08:32:43 MST ---- Created an attachment (id=171140) Fix to apply to mcs/mcs/assign.cs. Should work for gmcs as well. ---- Additional Comments From miguel@ximian.com 2007-01-01 03:27:57 MST ---- CCing Marek for his opinion. ---- Additional Comments From marek.safar@seznam.cz 2007-02-09 19:27:43 MST ---- Your second patch fixed this issue in better fashion. Imported an attachment (id=171140) Unknown operating system unknown. Setting to default OS "Other".