Bug 318856 (MONO75946) - [PATCH] CS0665 not checked for conditional operator
Summary: [PATCH] CS0665 not checked for conditional operator
Status: RESOLVED FIXED
Alias: MONO75946
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-08-31 18:26 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.08 KB, patch)
2005-08-31 18:26 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:29:06 UTC


---- Reported by atsushi@ximian.com 2005-08-31 11:26:16 MST ----

mcs reports CS0665 for if statement but not for conditional operator.

class Test
{
        public bool Foo (bool x)
        {
                bool b;
                return (b = true) ? true : b;
        }
}

Actual Results:

no warning.

Expected Results:

cs0665-2.cs(9,10): warning CS0665: Assignment in conditional expression is
always constant; did you mean to use == instead of = ?

The fix is attached.



---- Additional Comments From atsushi@ximian.com 2005-08-31 11:26:43 MST ----

Created an attachment (id=168439)
proposed fix




---- Additional Comments From rharinath@novell.com 2005-09-01 04:54:57 MST ----

Patch looks good.  Please apply.



---- Additional Comments From atsushi@ximian.com 2005-09-01 07:30:22 MST ----

done (r49256).

Imported an attachment (id=168439)

Unknown operating system unknown. Setting to default OS "Other".