July 15, 2011 A bug with DMD 2.054 | ||||
---|---|---|---|---|
| ||||
While coding, I've stumbled upon this weird bug. Apparently, this code snippet right here: module program; import std.stdio; class Foo { void bar() { writeln( "Foo Bar!" ); } } void main() { new Foo().bar(); } Doesn't work. It outputs the following error: program.d(12): found '.' when expecting ';' following statement Line 12 is: new Foo().bar(); |
July 15, 2011 Re: A bug with DMD 2.054 | ||||
---|---|---|---|---|
| ||||
Posted in reply to BizarreCake | On Fri, 15 Jul 2011 12:32:05 +0200, BizarreCake <bizarrecake@gmail.com> wrote: > While coding, I've stumbled upon this weird bug. > Apparently, this code snippet right here: > > module program; > > import std.stdio; > > class Foo { > void bar() { > writeln( "Foo Bar!" ); > } > } > > void main() { > new Foo().bar(); > } > > Doesn't work. > It outputs the following error: > program.d(12): found '.' when expecting ';' following statement > > Line 12 is: new Foo().bar(); This newsfroup is for automated posts by the BugZilla issue-tracker system. If you want to file a bug, please visit http://d.puremagic.com/issues/ or discuss your find in digitalmars.D.learn. As for your actual problem, thinks are working as intended. The compiler believes you wanted to write new (Foo().bar()); whereas you more likely meant (new Foo()).bar(); -- Simen |
Copyright © 1999-2021 by the D Language Foundation