By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,038 Members | 1,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,038 IT Pros & Developers. It's quick & easy.

Incorrect error report. Is member lookup for delegate simple-names (in error-case) corresponding to standart?

P: n/a
Look at example:

namespace N
{
class A { public void v() {}}
class B : A { new public const int v = 10; }
class C : B { new public void v ( int a ) {}}
class D : C
{
delegate void fun();
void f()
{
fun d = new fun ( v ); // refers B.v and produce error CS0118,
must be: refers to C.v() and produce error CS0123
}
}
}

There v in delegate creation expression refers to B.v and produce error
CS0118. It looks like member-lookup algorithm skip C.v() function because
formal arguments not applicable to delegate formal parameters. But standart
say that (14.3, p. 129): "If M is a method, then all non-method members
declared in a base type of S are removed from the set, and all methods with
the same signature as M declared in a base type of S are removed from the
set.", i.e. B.v must be hidden by C.v(). Probably v must refers to C.v() and
produce error CS0123? Or I something missing?

Alex.
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.