[Mono-list] mcs bug

Martin Aliger martin_aliger@email.cz
Mon, 30 Sep 2002 09:37:43 +0200 (CEST)


Hi all,

while my attempt to isolate bug in NAnt to send it to nant developers, I found another bug in mcs. It is not serious, but should be fixed.

It seems, that mcs assumes public visibility to contructors as default, rather than private as MS csc does. There is code to reproduce this:

-------
using System;

class Element
{
	string _name="";
	public String Name {get{return _name;}}

	Element(string s) //should be public
	{
		_name=s;
	}
}

class ElTest
{
	private Element _d=new Element("derived");
	public Element El {get{return _d;}}

	static public void Main()
	{
		ElTest t=new ElTest();
		Console.WriteLine(t.El.Name);
	}

}

-------

CSC throws error:
ell.cs(21,21): error CS0122: 'Element.Element(string)' is inaccessible due to its protection level

MCS compiles successfully and resulting code works :-)

Martin Aliger


______________________________________________________________________________
Domácí spotřebiče a elektronika za akční ceny – slevy až 50 %. 
Klikněte na: http://www.obchodni-dum.cz/index.phtml?prov=54&akce=yes