Bug 319265 (MONO76404) - [PATCH] mcs misses the location of CS0214 for constants
Summary: [PATCH] mcs misses the location of CS0214 for constants
Status: RESOLVED FIXED
Alias: MONO76404
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Atsushi Enomoto
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-11 10:15 UTC by Atsushi Enomoto
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
proposed fix (1.32 KB, patch)
2005-10-11 10:16 UTC, Thomas Wiest
Details | Diff
thus another patch (1.44 KB, patch)
2005-10-11 11:52 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:34:25 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".