File tree 2 files changed +26
-6
lines changed
2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,16 @@ extern (C)
390
390
void * _d_assocarrayliteralT (TypeInfo_AssociativeArray ti, size_t length, ... );
391
391
}
392
392
393
+ private template _Unqual (T)
394
+ {
395
+ static if (is (T U == shared (const U))) alias U _Unqual;
396
+ else static if (is (T U == const U )) alias U _Unqual;
397
+ else static if (is (T U == immutable U )) alias U _Unqual;
398
+ else static if (is (T U == inout U )) alias U _Unqual;
399
+ else static if (is (T U == shared U )) alias U _Unqual;
400
+ else alias T _Unqual;
401
+ }
402
+
393
403
struct AssociativeArray (Key, Value)
394
404
{
395
405
private :
@@ -399,8 +409,8 @@ private:
399
409
Slot * next;
400
410
size_t hash;
401
411
Key key;
402
- version (D_LP64 ) align (16 ) Value value; // c.f. rt/aaA.d, aligntsize()
403
- else align (4 ) Value value;
412
+ version (D_LP64 ) align (16 ) _Unqual ! Value value; // c.f. rt/aaA.d, aligntsize()
413
+ else align (4 ) _Unqual ! Value value;
404
414
405
415
// Stop creating built-in opAssign
406
416
@disable void opAssign(Slot);
@@ -549,7 +559,7 @@ public:
549
559
550
560
@property ref Value front()
551
561
{
552
- return state.front.value;
562
+ return * cast (Value * )& state.front.value;
553
563
}
554
564
555
565
alias state this ;
Original file line number Diff line number Diff line change @@ -2070,6 +2070,16 @@ extern (C)
2070
2070
hash_t _aaGetHash (void * aa, const (TypeInfo ) tiRaw) nothrow ;
2071
2071
}
2072
2072
2073
+ private template _Unqual (T)
2074
+ {
2075
+ static if (is (T U == shared (const U))) alias U _Unqual;
2076
+ else static if (is (T U == const U )) alias U _Unqual;
2077
+ else static if (is (T U == immutable U )) alias U _Unqual;
2078
+ else static if (is (T U == inout U )) alias U _Unqual;
2079
+ else static if (is (T U == shared U )) alias U _Unqual;
2080
+ else alias T _Unqual;
2081
+ }
2082
+
2073
2083
struct AssociativeArray (Key, Value)
2074
2084
{
2075
2085
private :
@@ -2079,8 +2089,8 @@ private:
2079
2089
Slot * next;
2080
2090
size_t hash;
2081
2091
Key key;
2082
- version (D_LP64 ) align (16 ) Value value; // c.f. rt/aaA.d, aligntsize()
2083
- else align (4 ) Value value;
2092
+ version (D_LP64 ) align (16 ) _Unqual ! Value value; // c.f. rt/aaA.d, aligntsize()
2093
+ else align (4 ) _Unqual ! Value value;
2084
2094
2085
2095
// Stop creating built-in opAssign
2086
2096
@disable void opAssign(Slot);
@@ -2229,7 +2239,7 @@ public:
2229
2239
2230
2240
@property ref Value front()
2231
2241
{
2232
- return state.front.value;
2242
+ return * cast (Value * )& state.front.value;
2233
2243
}
2234
2244
2235
2245
alias state this ;
You can’t perform that action at this time.
0 commit comments