digitalmars.D.bugs - Static method resolution bug (dmd 0.113)
-
zwang
(18/18)
Feb 18 2005
- zwang (24/44) Feb 18 2005 Here is a variant example to demonstrate the bug:
-
Stewart Gordon
(10/23)
Feb 18 2005
- zwang (2/10) Feb 18 2005 Thanks. I wasn't aware of this page before.
<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
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
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
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








zwang <nehzgnaw gmail.com>