www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - A bug with DMD 2.054

reply BizarreCake <bizarrecake gmail.com> writes:
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();
Jul 15 2011
parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
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
Jul 15 2011