Bugzilla – Bug 321876
[PARSER] CS1041 is not reported for invalid use of keyword
Last modified: 2008-10-10 10:56:26 UTC
---- Reported by gert.driesen@pandora.be 2006-08-25 13:43:26 MST ---- mcs and gmcs do not report CS1041 if a keyword is used for an identifier. To reproduce, compile the following code snippet: public class Test { static void Main () { string ref = "abc"; Console.WriteLine (ref); } } Expected result: test.cs(3,10): error CS1041: Identifier expected, 'ref' is a keyword test.cs(3,10): error CS1525: Invalid expression term 'ref' test.cs(4,25): error CS1525: Invalid expression term ')' test.cs(4,26): error CS1026: ) expected Actual result: test.cs(3,10): error CS1002: Expecting ';' test.cs(4,25): error CS1002: Expecting ';' ---- Additional Comments From marek.safar@seznam.cz 2007-02-18 09:05:22 MST ---- I think the issue is not possible to fix with current parser. ---- Additional Comments From rharinath@novell.com 2007-02-19 05:04:17 MST ---- We may just need to add an "error"-production to the appropriate rule. Of course this may get tedious if we want to add error productions to all declarations. (a student trainee has expressed interest in working on this bug) ---- Additional Comments From marek.safar@seznam.cz 2007-02-19 05:39:52 MST ---- Maybe I am wrong but in this case we cannot do any factorization otherwise we can reduce/reduce conflict. The option is to inline all keywords to all sections which is horrible. Unknown operating system unknown. Setting to default OS "Other".
Fixed in SVN.