Bug 323004 (MONO80313) - [PATCH] Implicit casts not considered with compound assignments
Summary: [PATCH] Implicit casts not considered with compound assignments
Status: RESOLVED FIXED
Alias: MONO80313
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Raja R Harinath
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-19 15:31 UTC by Martin Voelkle
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Fix to apply to mcs/mcs/assign.cs. Should work for gmcs as well. (623 bytes, patch)
2006-12-19 15:32 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:20:17 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".