Why won't this compile using DMD?

Simen Kjaeraas simen.kjaras at gmail.com
Sun Aug 12 07:31:22 PDT 2012


On Sun, 12 Aug 2012 09:39:13 +0200, Ivan Trombley <itrombley at dot-borg.org>  
wrote:

> I'm stumped. Can anyone tell me why this won't compule using DMD  
> (v2.060)? It compiles and runs just fine using GDC:

The problems all have to do with one thing - shared class Data does
not mean every instance of the class is shared, only that all member
functions are.

Hence,

>      auto data = receiveOnly!(Data);

should be

auto data = receiveOnly!(shared Data);

and

>      auto data = new Data(count);

should be

auto data = cast(shared)new Data(count);

-- 
Simen


More information about the Digitalmars-d mailing list