Bugzilla – Bug 319265
[PATCH] mcs misses the location of CS0214 for constants
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2005-10-11 03:15:40 MST ---- mcs misses the location of CS0214 for constants. class Test { public void Main () { byte* arr = stackalloc byte [4]; } } Actual Results: $ mcs cs0214-location.cs error CS0214: Pointers and fixed size buffers may only be used in an unsafe context Expected Results: cs0214-loc.cs(7,7): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context How often does this happen? consistently. Additional Information: A fix being attached. ---- Additional Comments From atsushi@ximian.com 2005-10-11 03:16:35 MST ---- Created an attachment (id=168656) proposed fix ---- Additional Comments From rharinath@novell.com 2005-10-11 03:46:39 MST ---- Hmm... Don't you need to pass the newly computed locations to the ComposedCast constructor in the first two cases? ---- Additional Comments From atsushi@ximian.com 2005-10-11 04:18:37 MST ---- In the first two cases, GetLocation() might result in null Location for builtin_types (which does not have location). That's why lexer.Location is assigned (only when the location could not be acquired). Basically there we should not use builtin_types directly but use something like a type reference, but this is rather small fix. ---- Additional Comments From atsushi@ximian.com 2005-10-11 04:21:02 MST ---- oops, you're right ;-) ---- Additional Comments From atsushi@ximian.com 2005-10-11 04:52:58 MST ---- Created an attachment (id=168657) thus another patch ---- Additional Comments From rharinath@novell.com 2005-10-12 08:41:03 MST ---- Looks good, please apply. ---- Additional Comments From atsushi@ximian.com 2005-10-14 04:41:54 MST ---- Ok, applied (r51705). Imported an attachment (id=168656) Imported an attachment (id=168657) Unknown operating system unknown. Setting to default OS "Other".