Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #877 from 9rnsr/fix13078
Browse files Browse the repository at this point in the history
[REG2.066a] Issue 13078 - [dmd 2.066-b2] AA rehash failed with shared
  • Loading branch information
yebblies committed Jul 11, 2014
2 parents 930e0ac + f05177b commit a13628a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/object.di
Expand Up @@ -375,13 +375,25 @@ extern (C)

alias AssociativeArray(Key, Value) = Value[Key];

Value[Key] rehash(T : Value[Key], Value, Key)(auto ref T aa)
T rehash(T : Value[Key], Value, Key)(T aa)
{
_aaRehash(cast(void**)&aa, typeid(Value[Key]));
return aa;
}

Value[Key] rehash(T : Value[Key], Value, Key)(T* aa)
T rehash(T : Value[Key], Value, Key)(T* aa)
{
_aaRehash(cast(void**)aa, typeid(Value[Key]));
return *aa;
}

T rehash(T : shared Value[Key], Value, Key)(T aa)
{
_aaRehash(cast(void**)&aa, typeid(Value[Key]));
return aa;
}

T rehash(T : shared Value[Key], Value, Key)(T* aa)
{
_aaRehash(cast(void**)aa, typeid(Value[Key]));
return *aa;
Expand Down
23 changes: 21 additions & 2 deletions src/object_.d
Expand Up @@ -1963,13 +1963,25 @@ extern (C)

alias AssociativeArray(Key, Value) = Value[Key];

Value[Key] rehash(T : Value[Key], Value, Key)(auto ref T aa)
T rehash(T : Value[Key], Value, Key)(T aa)
{
_aaRehash(cast(void**)&aa, typeid(Value[Key]));
return aa;
}

Value[Key] rehash(T : Value[Key], Value, Key)(T* aa)
T rehash(T : Value[Key], Value, Key)(T* aa)
{
_aaRehash(cast(void**)aa, typeid(Value[Key]));
return *aa;
}

T rehash(T : shared Value[Key], Value, Key)(T aa)
{
_aaRehash(cast(void**)&aa, typeid(Value[Key]));
return aa;
}

T rehash(T : shared Value[Key], Value, Key)(T* aa)
{
_aaRehash(cast(void**)aa, typeid(Value[Key]));
return *aa;
Expand Down Expand Up @@ -2263,6 +2275,13 @@ pure nothrow unittest
aa[1] = 1;
}

pure nothrow unittest
{
// bug 13078
shared string[][string] map;
map.rehash;
}

deprecated("Please use destroy instead of clear.")
alias destroy clear;

Expand Down

0 comments on commit a13628a

Please sign in to comment.