dtors in shared structs fail to compile

Artur Skawina art.08.09 at gmail.com
Fri Feb 17 08:20:21 PST 2012


> problem; this program compiles only when one of the lines marked with '*' is
> commented out:
> 
> ==================================
> shared                  // *
> struct S(T) {
>    T i;
>    @disable this(this); // *
> }
> 
> auto s1 = S!int(42);
> void main() {
>    //auto s2 = s1;
> }
> ==================================
> 
> Known bug?

Similar to the above, but obviously a much bigger problem, especially
as I haven't found any workaround yet...

==================================
shared                  // *
struct S(T) {
   T i;
   this(int v) {i=v;}
   ~this() {}           // *
}

auto s1 = S!int(42);
void main() {
   //auto s2 = s1;
}
==================================

Fails with "Error: destructor blah.S!(int).S.~this () shared is not callable using argument types ()"

IIRC I actually ran into this in non-shared structs which had shared fields,
but the error messages were not exactly very informative and lacked any line
number info, so i can't really  be sure it was the same problem.

artur



More information about the Digitalmars-d mailing list