[Mono-bugs] [Bug 316137] mcs produces CS0219 warning where csc does not

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 6 08:45:13 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=316137

User harinath at hurrynot.org added comment
https://bugzilla.novell.com/show_bug.cgi?id=316137#c3





--- Comment #3 from Raja Harinath <harinath at hurrynot.org>  2008-05-06 06:45:13 MST ---
And so it does:

---------------8<----------------
class Foo {
        struct Bar {
                public int a;
                public Bar (int a) { this.a = a; }
        }

        static void Main ()
        {
                object os = null;
                object oc = new System.Exception ();

                int i0 = 0;
                int i0d = new int ();

                int i1 = 1;

                Bar bs = new Bar ();
                Bar bc = new Bar (2);
                Bar ba; ba.a = 3;
        }
}
---------------8<----------------

produces the following warnings:

---------------8<----------------
foo22.cs(9,10): warning CS0219: The variable 'os' is assigned but its value is
never used
foo22.cs(12,7): warning CS0219: The variable 'i0' is assigned but its value is
never used
foo22.cs(13,7): warning CS0219: The variable 'i0d' is assigned but its value is
never used
foo22.cs(15,7): warning CS0219: The variable 'i1' is assigned but its value is
never used
foo22.cs(17,7): warning CS0219: The variable 'bs' is assigned but its value is
never used
---------------8<----------------

Note the absense of 'oc' and 'bc', which have non-trivial constructors.  I'm
not surprised that 'ba' isn't warned about, either -- it's too pedantic a case
for a warning like this.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list