[Mono-bugs] [Bug 450530] New: GMCS error CS0654 Method is referenced without parentheses
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Dec 1 11:38:47 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=450530
Summary: GMCS error CS0654 Method is referenced without
parentheses
Product: Mono: Compilers
Version: 2.0.x
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: petee at mindtouch.com
QAContact: mono-bugs at lists.ximian.com
Found By: Community User
Basically, the error only occurs if a method has overloads to either accept a
value or a delegate that returns that same value. In that case, when you pass
the a function that returns that value, mono thinks you are trying to call the
one that takes the value and forgot the parentheses.
-------------------------
using System;
namespace MonoTester {
public delegate Value Handler();
class Program {
static void Main(string[] args) {
Do(Value.Default);
Do(Value.Default());
}
public static void Do(Value v) {}
public static void Do(Handler h) {}
}
public class Value {
public static Value Default() {
return new Value();
}
}
}
-------------------------------------
Macintosh-3:mono arne$ gmcs Program.cs
Program.cs(7,22): error CS0654: Method `MonoTester.Value.Default()' is
referenced without parentheses
Compilation failed: 1 error(s), 0 warnings
However this second version works fine... no idea why. Because the Method being
passes is in the same class?
-----------------------------------------
namespace MonoTester {
public delegate Value Handler();
class Program {
static void Main(string[] args) {
Do(Program . Default);
Do(Program . Default());
}
public static void Do(Value v) {}
public static void Do(Handler h) {}
public static Value Default() { return null; }
}
public class Value {
}
}
--
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