shared and cryptic error messages

Jason House jason.james.house at gmail.com
Wed Mar 30 15:34:45 PDT 2011


he compiler wants "argument types () shared" instead of "argument types ()". It's an awful error message, and I'm certain I filed a bug for it at least a year ago. In the toy example, mark the destructor as shared, and it should compile.

Jose Armando Garcia Wrote:

> It looks like the following works:
> 
> struct B {}
> synchronized class A { private B b }
> 
> but this doesn't:
> 
> struct B { ~this() {} }
> synchronized class A { private B b }
> 
> On Wed, Mar 30, 2011 at 4:59 PM, Jose Armando Garcia <jsancio at gmail.com> wrote:
> > import std.stdio;
> >
> > class B
> > {
> >  private File file;
> > }
> > synchronized class A
> > {
> >  private File file;
> > }
> >
> > void main()
> > {
> > }
> >
> > /usr/include/d/dmd/phobos/std/stdio.d(292): Error: destructor
> > std.stdio.File.~this () is not callable using argument types ()
> >
> > Why am I getting this error? I suspect that synchronized is the
> > problem. How do I get around this error? Does this mean that
> > synchronized classes are not allowed to have as member
> > unsynchronized/regular classes? Has anyone tried to write a
> > multithreaded application using D? Why is the error showing up in
> > std/stdio.d and not in my file? Can anyone point me to a decent
> > documentation of how "shared" works? I have read chapter 13 of The D
> > Programming Language and it is not sufficient for the level of
> > understanding I seek.
> >
> > That is a lot of question. Hopefully I get answer to at least one.
> >



More information about the Digitalmars-d mailing list