Bug 325841

Summary: GMCS Regression using += operator on array elements
Product: [Mono] Mono: Compilers Reporter: Joachim ANTE <joe>
Component: C#Assignee: Marek Safar <msafar>
Status: RESOLVED FIXED QA Contact: Mono Bugs <mono-bugs>
Severity: Blocker    
Priority: P5 - None CC: alan.mcgovern, gert.driesen
Version: 1.2   
Target Milestone: ---   
Hardware: Other   
OS: Mac OS X 10.4   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Joachim ANTE 2007-09-17 22:12:26 UTC
The following script when compiled by gmcs and run with mono using 15 9 2007 daily build, will give an invalid program exception. Using 1.2.5 this script compiles & runs flawlessly.
The culprit is the += operator when used on on array elements.




class Testing
{
	public struct MyColor
	{
		float _value;
		
		public MyColor (float invalue)
		{
			_value =  invalue;	
		}
		
		static public MyColor operator + (MyColor a, MyColor b)
		{
			return new MyColor(a._value + b._value);	
		}
	}

	static void Main () {
		MyColor[] c = new MyColor [1];
		c[0] += new MyColor (1.0F);
		System.Console.WriteLine("Finnished running to the end");
	}
}
Comment 1 Gert Driesen 2007-09-18 08:37:24 UTC
Added test-586.cs to mcs/tests.
Comment 2 Gert Driesen 2007-09-18 15:49:57 UTC
*** Bug 326036 has been marked as a duplicate of this bug. ***
Comment 3 Marek Safar 2007-10-04 14:43:38 UTC
Fixed in SVN.