A bug with DMD 2.054

Simen Kjaeraas simen.kjaras at gmail.com
Fri Jul 15 05:01:56 PDT 2011


On Fri, 15 Jul 2011 12:32:05 +0200, BizarreCake <bizarrecake at 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


More information about the Digitalmars-d-bugs mailing list