[Mono-list] Bug related to operator += and instance fields
Brice Carpentier
brice@dlfp.org
Sat, 21 Feb 2004 22:48:16 +0100
Rodolfo Campero wrote:
> Hello everybody,
Hi
>
> I've found a bug, but I'm not sure about how to report it (I mean I
> can't find a suitable subject and other info):
>
> The following source code compiles but its execution results in
> incorrect behavior:
>
> <code>
> using System;
> namespace Test {
> public class A {
> public static void Main () {
> A a = new A ();
I'm not sure...but isn't that a bit weird to put the previous line in
A's constructor ?
I dunno a lot about C# so I may be wrong, of course.
I think doing that you enter a recursive infinit loop.
> a.Test ();
> }
>
> public void Test ()
> {
> A a = new A ();
Same comment...
> // the following is the problematic line
> _intValue += a.Value + a.Value / 2;
> Console.WriteLine (_intValue);
> }
>
> private int _intValue;
> public readonly int Value = 100;
> }
> }
> </code>
>
> The actual result is 50 but I think it should be 150.
>
> I need someone to give me instructions about the affected product
> (Mono/Compilers or Mono/Runtime or ...) and a suitable subject if
> possible, or to tell me that this is not a bug and I'm plain wrong :-)
>
> If someone can file the bug report for me it's ok too.
>
> TIA,
>
> Rodolfo
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
Sincerely yours,
--
Brice Carpentier aka Br|ce