www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dtors in shared structs fail to compile

 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
Feb 17 2012