[Mono-bugs] [Bug 460016] New: Mix up between a type and outer type properties.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 17 19:39:16 EST 2008


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


           Summary: Mix up between a type and outer type properties.
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: spouliot at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The following code compiles with both MCS and GMCS but not with CSC.

Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

nestor.cs(31,11): error CS0120: An object reference is required for the
        non-static field, method, or property 'Runner.Report()'
nestor.cs(12,16): (Location of symbol related to previous error)

-----------------------------------------------------------------------------

using System;

public class Runner {

        string msg;

        public Runner (string s)
        {
                msg = s;
        }

        public string Report ()
        {
                return msg;
        }
}

public class Outer {

        private Runner r = new Runner ("Outer");

        public Runner Runner {
                get { return r; }
                set { r = value; }
        }

        class Inner {

                public string Check ()
                {
                        return Runner.Report ();
                }
        }

        static void Main ()
        {
                Console.WriteLine (new Inner ().Check ());
        }
}


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


More information about the mono-bugs mailing list