Bugzilla – Bug 319454
[ANONYMOUS METHODS] mcs does not properly detect variable name conflicts when using anonymous methods
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by eric@extremeboredom.net 2005-11-02 16:27:16 MST ---- The following code should not compile: public class AnonTest { public static void Main () { new AnonTest (); } delegate void MooEventHandler (string moo); event MooEventHandler bleh; public AnonTest () { AddEvent ("moo"); } void AddEvent (string moo) { bleh += delegate (string moo) { System.Console.WriteLine (moo); }; } } On .NET 2.0 final, the following error is generated: test.cs(20,21): error CS0136: A local variable named 'moo' cannot be declared in this scope because it would give a different meaning to 'moo', which is already used in a 'parent or current' scope to denote something else ---- Additional Comments From eric@extremeboredom.net 2005-11-02 16:29:43 MST ---- Sorry, this is with 1.1.9.2 and confirmed still a problem with SVN as of this morning. ---- Additional Comments From rharinath@novell.com 2006-09-28 10:29:34 MST ---- may be relevant to the new anonymous-methods work ---- Additional Comments From martin@ximian.com 2006-10-04 18:20:48 MST ---- Fixed in SVN.