www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Static method resolution bug (dmd 0.113)

reply zwang <nehzgnaw gmail.com> writes:
<code>











</code>


DMD 0.113 complains:
"test.d(9): 'this' is required, but B is not a base class of A"
As we can see, class A doesn't have to derive from B to call its
static method.

Feb 18 2005
parent reply zwang <nehzgnaw gmail.com> writes:
Here is a variant example to demonstrate the bug:
<code>
class B{
   void f(int i){}
   static void f(){}
}
void main(){
   B.f();
}
</code>

DMD error message:
"test.d(6): 'this' is only allowed in non-static member functions"

Interestingly, if we switch the order of method declaration,
the code compiles happily.
<code>
class B{
   static void f(){}
   void f(int i){}
}
void main(){
   B.f();
}
</code>


zwang wrote:
 <code>











 </code>
 
 
 DMD 0.113 complains:
 "test.d(9): 'this' is required, but B is not a base class of A"
 As we can see, class A doesn't have to derive from B to call its
 static method.

Feb 18 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
zwang wrote:
 Here is a variant example to demonstrate the bug:
 <code>
 class B{
   void f(int i){}
   static void f(){}
 }
 void main(){
   B.f();
 }
 </code>
 
 DMD error message:
 "test.d(6): 'this' is only allowed in non-static member functions"
<snip top of upside-down reply> This bug has been around for ages and reported several times. Here are just some of the bugs that have been around for a while (if you haven't found it already): http://www.wikiservice.at/wiki4d/wiki.cgi?PendingPeeves Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Feb 18 2005
parent zwang <nehzgnaw gmail.com> writes:
Stewart Gordon wrote:
 This bug has been around for ages and reported several times.  Here are 
 just some of the bugs that have been around for a while (if you haven't 
 found it already):
 
 http://www.wikiservice.at/wiki4d/wiki.cgi?PendingPeeves
 
 Stewart.
 
Thanks. I wasn't aware of this page before.
Feb 18 2005