digitalmars.D.bugs - dmd .126 scope bug?
- clayasaurus (16/16) Jun 10 2005 The following code compiles fine and crashes. I think it should produce
- Walter (4/6) Jun 10 2005 Being able to redeclare names inside scopes is the whole point of having
- Hasan Aljudy (5/16) Jun 10 2005 Yeah, the problem here isn't exactly scope, it's the use of an
- clayasaurus (18/29) Jun 11 2005 I guess my main problem is that, I wasn't able to use an assert to catch...
- clayasaurus (2/41) Jun 11 2005
- James McComb (5/7) Jun 11 2005 It does produce an error, but only if you use the -w compiler switch.
- clayasaurus (3/16) Jun 11 2005 Erm... that just means it wants a return 0 at the end of main, which
- James McComb (3/5) Jun 11 2005 Right you are. I must have had a brain malfunction. ;)
- clayasaurus (2/11) Jun 11 2005 I've had plenty of those too lately :-/
The following code compiles fine and crashes. I think it should produce an error that foo is already defined? It took a while for me to catch it. class Foo { void dostuff() {} } Foo foo; void init() { Foo foo = new Foo; } int main() { init(); foo.dostuff(); }
Jun 10 2005
"clayasaurus" <clayasaurus gmail.com> wrote in message news:d8dsit$2nft$1 digitaldaemon.com...The following code compiles fine and crashes. I think it should produce an error that foo is already defined?Being able to redeclare names inside scopes is the whole point of having scopes.
Jun 10 2005
Walter wrote:"clayasaurus" <clayasaurus gmail.com> wrote in message news:d8dsit$2nft$1 digitaldaemon.com...Yeah, the problem here isn't exactly scope, it's the use of an un-initialized variable. Shouldn't that produce some sort of error? (I read that the compiler doesn't produce warnings; it's either an error or not).The following code compiles fine and crashes. I think it should produce an error that foo is already defined?Being able to redeclare names inside scopes is the whole point of having scopes.
Jun 10 2005
Walter wrote:"clayasaurus" <clayasaurus gmail.com> wrote in message news:d8dsit$2nft$1 digitaldaemon.com...I guess my main problem is that, I wasn't able to use an assert to catch it! class Foo { void dostuff() {} } Foo foo; void init() { Foo foo = new Foo; } int main() { init(); assert(foo is null); foo.dostuff(); } Shouldn't this through an assert error? *confused*The following code compiles fine and crashes. I think it should produce an error that foo is already defined?Being able to redeclare names inside scopes is the whole point of having scopes.
Jun 11 2005
nevermind. clayasaurus wrote:Walter wrote:"clayasaurus" <clayasaurus gmail.com> wrote in message news:d8dsit$2nft$1 digitaldaemon.com...I guess my main problem is that, I wasn't able to use an assert to catch it! class Foo { void dostuff() {} } Foo foo; void init() { Foo foo = new Foo; } int main() { init(); assert(foo is null); foo.dostuff(); } Shouldn't this through an assert error? *confused*The following code compiles fine and crashes. I think it should produce an error that foo is already defined?Being able to redeclare names inside scopes is the whole point of having scopes.
Jun 11 2005
clayasaurus wrote:The following code compiles fine and crashes. I think it should produce an error that foo is already defined? It took a while for me to catch it.It does produce an error, but only if you use the -w compiler switch. You'll get the following warning: function main no return at end of function James McComb
Jun 11 2005
James McComb wrote:clayasaurus wrote:Erm... that just means it wants a return 0 at the end of main, which wasn't my problem.The following code compiles fine and crashes. I think it should produce an error that foo is already defined? It took a while for me to catch it.It does produce an error, but only if you use the -w compiler switch. You'll get the following warning: function main no return at end of function James McComb
Jun 11 2005
clayasaurus wrote:Erm... that just means it wants a return 0 at the end of main, which wasn't my problem.Right you are. I must have had a brain malfunction. ;) James McComb
Jun 11 2005
James McComb wrote:clayasaurus wrote:I've had plenty of those too lately :-/Erm... that just means it wants a return 0 at the end of main, which wasn't my problem.Right you are. I must have had a brain malfunction. ;) James McComb
Jun 11 2005