hashes of hashes not supported

Maxim Fomin maxim at maxim-fomin.ru
Fri Nov 9 09:27:16 PST 2012


On Friday, 9 November 2012 at 16:24:31 UTC, Dan wrote:
> I'm using (DMD64 D Compiler v2.061) and don't see it, so it 
> seems moving from v2.060 to v2.061 takes away some useful error 
> messages which is bad.

Experimenting on dpaste site shows that error message was fixed 
in trunk (you can select compiler version there).

>
> I don't think making postblit accept const works - did it for 
> you? If you just mean "this(const this)" it does make it 
> compile - but that postblit is not called.
>

Making parameter to be const solves that problem.

> For example, in code below nothing is printed. Maybe there is a 
> better signature - what did you use? Make postblit this(this) 
> and it is printed. Back to the other example - it seems only 
> this(this) is ever recognized and having this(this) is a 
> problem with associative arrays.
>
> Here is a related thread which in my mind is not resolved.
>
> http://forum.dlang.org/thread/jonkbhtibdxjfjethtuo@forum.dlang.org#post-jonkbhtibdxjfjethtuo:40forum.dlang.org
>
> Thanks
> Dan
>
> import std.stdio;
> struct S {
>   this(const this) { writeln("Is this called"); }
> }
>
> void main() {
>   S x;
>   const(S) cx;
>   S x2 = x;
>   S x3 = cx;
> }

Look at this: http://dpaste.dzfl.pl/1f60055d. It is a combination 
of original code and code above. It fails to compile, but 
commenting this(this) makes dmd happy. Alternatively you can 
comment S[S[string]] w1, w2 and everything also works fine.



More information about the Digitalmars-d-learn mailing list