[Mono-bugs] [Bug 516379] New: Ambiguity between overloaded indexers and a static member of an Item type

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jun 25 05:44:41 EDT 2009


           Summary: Ambiguity between overloaded indexers and a static
                    member of an Item type
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: LittleEndian
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: skeet at pobox.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User

This is pretty obsecure :)

Description of Problem:

I have a type called Item with a static member I wish to access, but the type
from which I need to access it has two indexers. This causes gmcs to complain,
but the MS C# compiler is fine.

Steps to reproduce the problem:
1. Attempt to compile this code:

using System;

class Item
    internal static object Field = "Test";

class Caller
    public string this[string x]
        get { return x; }

    public int this[int x]
        get { return x; }

    public void Foo()

Actual Results:

Test.cs(22,9): error CS0229: Ambiguity between `Caller.this[string]' and
Test.cs(10,19): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

Expected Results:

Successful compilation.

How often does this happen? 

Every time.

Additional Information:

If the indexer isn't overloaded, it works correctly. Fully qualifying Item
(e.g. global::Item) works around the issue.

Configure bugmail: http://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