[Mono-list] Is it a bug?

Hans-Jürgen Schönig mono@cybertec.at
Thu, 15 Aug 2002 20:12:20 +0200


I am trying to implement a simple class for handling complex numbers.
When I compile a piece of code it works but when I try to run the code 
there is an error:


[hs@duron klassen]$ mcs complex.cs
Compilation succeeded
[hs@duron klassen]$ mono complex.exe

** (process:26579): WARNING **: unknown type 01

** ERROR **: file helpers.c: line 113 (mono_map_stind_type): should not 
be reached
aborting...
Aborted




[hs@duron klassen]$ mint complex.exe
110 + 220
** (process:26593): WARNING **: got type 1

** ERROR **: file interp.c: line 472 (stackval_to_data): should not be 
reached
aborting...
Aborted


I guess my program works (I have copied it from a tutorial) but somehow 
there seems to be something wrong.
Here is the code I am trying to run:

using System;

public class    Complex
{
        int     x;
        int     y;

        // Konstruktor fuer 'leere' Zahlen
        public Complex()
        {
        }

        // Konstruktor fuer zum Initialisieren von Werten
        public Complex(int i, int j)
        {
                x = i;
                y = j;
        }

        // Ausgeben einer komplexen Zahl
        public void PrintComplex()
        {
                Console.Write( x + " + " + y);
        }


        // Addieren von komplexen Zahlen
        public static Complex operator+(Complex z1, Complex z2)
        {
                Complex result = new Complex();
                result.x = z1.x + z2.x;
                result.y = z1.y + z2.y;
                return result;
        }
}

public class    Demo
{
        public static void Main()
        {
                Complex zahl1 = new Complex(10, 20);
                Complex zahl2 = new Complex(100, 200);
                Complex ergebnis = new Complex();

                ergebnis = zahl1 + zahl2;
                Console.WriteLine( ergebnis.PrintComplex() );
        }
}


I am running ...
mono-0.13_baselabs-20020731.i386.rpm on Redhat 7.3

Can anybody help me?

    Hans