Thread overview |
---|
April 05, 2004 [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
this does not compile: ################## class C { this() { f(); } static { void f(int i) { } } void f() { } // void ff() { f(); } } int main(char[][] args) { return 0; } ############## $ dmd OneNotZero.d -I~/dmd/src/phobos OneNotZero.d(5): need 'this' to access member f ############## if the static method f is defined after the non static method f compiles OK I found this when the compiler issued the message: "./leds/ProjectTarget.d(664): Error: expected 1 arguments, not 0" on a similar situation Ant |
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Yea ive never seen static { } , I dont think that should be allowed ( or is that the bug your reporting ? ) This compiles though class C { this() { f(); } static void f(int i) { } void f() { } // void ff() { f(); } } int main(char[][] args) { return 0; } On Sun, 04 Apr 2004 21:05:07 -0400, Ant <duitoolkit@yahoo.ca> wrote: > this does not compile: > > ################## > class C > { > this() > { > f(); > } > > static { > void f(int i) > { > } > } > > void f() > { > } > > // > > void ff() > { > f(); > } > } > > int main(char[][] args) > { > return 0; > } > ############## > $ dmd OneNotZero.d -I~/dmd/src/phobos > OneNotZero.d(5): need 'this' to access member f > ############## > if the static method f is defined after > the non static method f compiles OK > > I found this when the compiler issued the message: > "./leds/ProjectTarget.d(664): Error: expected 1 arguments, not 0" > on a similar situation > > Ant > -- D Newsgroup. |
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to C | On Sun, 04 Apr 2004 22:44:49 -0700, C wrote: > Yea ive never seen static { } , I dont think that should be allowed ( or is that the bug your reporting ? ) > > This compiles though No, it does not for me, maybe platfom it's specific I'm on linux dmd 0.81. you can have for all the modifiers: static: from now on (maybe not with static but works for others) and static one member and static {} the block Ant ############################ > > class C > { > this() > { > f(); > } > > static void f(int i) > { > } > > > void f() > { > } > > // > > void ff() > { > f(); > } > } > > int main(char[][] args) > { > return 0; > } > > > On Sun, 04 Apr 2004 21:05:07 -0400, Ant <duitoolkit@yahoo.ca> wrote: > >> this does not compile: >> >> ################## >> class C >> { >> this() >> { >> f(); >> } >> >> static { >> void f(int i) >> { >> } >> } >> >> void f() >> { >> } >> >> // >> >> void ff() >> { >> f(); >> } >> } >> >> int main(char[][] args) >> { >> return 0; >> } >> ############## >> $ dmd OneNotZero.d -I~/dmd/src/phobos >> OneNotZero.d(5): need 'this' to access member f >> ############## >> if the static method f is defined after >> the non static method f compiles OK >> >> I found this when the compiler issued the message: "./leds/ProjectTarget.d(664): Error: expected 1 arguments, not 0" on a similar situation >> >> Ant >> |
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Hmm, it works for me using .82, maybe try that ? > you can have for all the modifiers: > > static: from now on (maybe not with static but works for others) > and > static one member > and > static {} the block Cool! C On Mon, 05 Apr 2004 01:15:45 -0400, Ant <duitoolkit@yahoo.ca> wrote: > On Sun, 04 Apr 2004 22:44:49 -0700, C wrote: > >> Yea ive never seen static { } , I dont think that should be allowed ( or >> is that the bug your reporting ? ) >> >> This compiles though > > No, it does not for me, maybe platfom it's specific > I'm on linux dmd 0.81. > > you can have for all the modifiers: > > static: from now on (maybe not with static but works for others) > and > static one member > and > static {} the block > > > Ant > ############################ > >> >> class C >> { >> this() >> { >> f(); >> } >> >> static void f(int i) >> { >> } >> >> >> void f() >> { >> } >> >> // >> >> void ff() >> { >> f(); >> } >> } >> >> int main(char[][] args) >> { >> return 0; >> } >> >> >> On Sun, 04 Apr 2004 21:05:07 -0400, Ant <duitoolkit@yahoo.ca> wrote: >> >>> this does not compile: >>> >>> ################## >>> class C >>> { >>> this() >>> { >>> f(); >>> } >>> >>> static { >>> void f(int i) >>> { >>> } >>> } >>> >>> void f() >>> { >>> } >>> >>> // >>> >>> void ff() >>> { >>> f(); >>> } >>> } >>> >>> int main(char[][] args) >>> { >>> return 0; >>> } >>> ############## >>> $ dmd OneNotZero.d -I~/dmd/src/phobos >>> OneNotZero.d(5): need 'this' to access member f >>> ############## >>> if the static method f is defined after >>> the non static method f compiles OK >>> >>> I found this when the compiler issued the message: >>> "./leds/ProjectTarget.d(664): Error: expected 1 arguments, not 0" >>> on a similar situation >>> >>> Ant >>> > -- D Newsgroup. |
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to C | On Sun, 04 Apr 2004 23:33:23 -0700, C wrote:
> Hmm, it works for me using .82, maybe try that ?
Sorry I mean: linux .82
maybe it's a linux only bug.
or are you on linux?
(some times I'm the first to complain about the new
dmd release, you really thought I wasn't at 82?... ;)
Ant
|
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | > you can have for all the modifiers: > > static: from now on (maybe not with static but works for others) > and > static one member > and > static {} the block Is this just a new feature? I didnt know D had static blocks, good news! Phill. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004 |
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | > (some times I'm the first to complain about the new > dmd release, you really thought I wasn't at 82?... ;) lol good point. No im on windows, but unless its a linking error it seems really odd that that would fail on linux, but succeed on windows. <shrug> But I do get the same error message ( f.d(5): need 'this' to access member f ) when using the static { } block, which seems like a bug. C On Mon, 05 Apr 2004 01:36:27 -0400, Ant <duitoolkit@yahoo.ca> wrote: > On Sun, 04 Apr 2004 23:33:23 -0700, C wrote: > >> Hmm, it works for me using .82, maybe try that ? > > Sorry I mean: linux .82 > > maybe it's a linux only bug. > or are you on linux? > > (some times I'm the first to complain about the new > dmd release, you really thought I wasn't at 82?... ;) > > Ant > -- D Newsgroup. |
April 05, 2004 Re: [BUG] compiler: need 'this' | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phill | In article <c4qrut$2juj$1@digitaldaemon.com>, Phill says... > >> you can have for all the modifiers: >> >> static: from now on (maybe not with static but works for others) >> and >> static one member >> and >> static {} the block > >Is this just a new feature? >I didnt know D had static blocks, good news! > >Phill. I just check to confirm I'm not going crazy. http://www.digitalmars.com/d/attribute.html All attributes can use the 3 forms including: static{}else{} Ant |
Copyright © 1999-2021 by the D Language Foundation