Bugzilla – Bug 314021
[PATCH] Duplicate constructors getting compiled
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by gsanjay@novell.com 2004-03-04 00:05:50 MST ---- Please fill in this template when reporting a bug, unless you know what you are doing. Description of Problem: MCS compiler doesnot flags an error while compiling a library with two similar constructors. Steps to reproduce the problem: 1. Compile the attached script with mcs -target:library classTest.cs 2. 3. Actual Results: Compilation succeeded Expected Results: Should throw an error stating duplicate constructor. How often does this happen? Always Additional Information: Version for the compiler obtained through command mcs --version Mono C# compiler version 0.30.99.0 ---- Additional Comments From gsanjay@novell.com 2004-03-04 00:06:47 MST ---- Created an attachment (id=165695) Test script for the bug to be reproduced. ---- Additional Comments From bmaurer@users.sf.net 2004-03-04 00:11:07 MST ---- You need a main method for this to compile, so here is a test we could put in /errors class T { T () {} T () {} static void Main () {} } ---- Additional Comments From miguel@ximian.com 2004-03-04 13:50:36 MST ---- Ben, this sounds like a recently introduced regression; Could you verify if your code touched on this? You also have been looking at this code recently, so you might be able to help us. ---- Additional Comments From bmaurer@users.sf.net 2004-03-04 14:12:34 MST ---- Ok, basically the issue is that we need to have a CheckBase like thingy for the Constructor class. The code tries to use TypeManager.RegisterMethod to do the checking, however this function oddly always returns true. Maybe someone did a bug fix for the Method class, but did not move it over to Constructor. Note to self: Also check indexers. ---- Additional Comments From bmaurer@users.sf.net 2004-03-08 23:06:28 MST ---- Created an attachment (id=165696) patch ---- Additional Comments From bmaurer@users.sf.net 2004-03-08 23:07:33 MST ---- Very simple patch, just copy & paste from the method case to check for dup overloads. ---- Additional Comments From bmaurer@users.sf.net 2004-03-08 23:16:59 MST ---- Before, we were trying to call RegisterMethod to do the validation, however this method just returns true. We have to do the checking ourselfs. So, I overrode CheckBase and did the validation there. A few other validation items were moved up as well (for consistancy). ---- Additional Comments From bmaurer@users.sf.net 2004-03-09 08:05:55 MST ---- Lets get this bug metadata'd up ---- Additional Comments From bmaurer@users.sf.net 2004-03-11 17:25:13 MST ---- Fixed in CVS. Imported an attachment (id=165695) Imported an attachment (id=165696) Unknown operating system unknown. Setting to default OS "Other".