Skip to content

Commit 9ad245c

Browse files
committed
Merge pull request #490 from 9rnsr/fix10106
Issue 10106 - [ICE] Ice in glue.c:1215 + 2 error messages without lines
2 parents 12b2214 + ee8aeeb commit 9ad245c

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/object.di

+13-3
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,16 @@ extern (C)
390390
void* _d_assocarrayliteralT(TypeInfo_AssociativeArray ti, size_t length, ...);
391391
}
392392

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+
393403
struct AssociativeArray(Key, Value)
394404
{
395405
private:
@@ -399,8 +409,8 @@ private:
399409
Slot *next;
400410
size_t hash;
401411
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;
404414

405415
// Stop creating built-in opAssign
406416
@disable void opAssign(Slot);
@@ -549,7 +559,7 @@ public:
549559

550560
@property ref Value front()
551561
{
552-
return state.front.value;
562+
return *cast(Value*)&state.front.value;
553563
}
554564

555565
alias state this;

src/object_.d

+13-3
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,16 @@ extern (C)
20702070
hash_t _aaGetHash(void* aa, const(TypeInfo) tiRaw) nothrow;
20712071
}
20722072

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+
20732083
struct AssociativeArray(Key, Value)
20742084
{
20752085
private:
@@ -2079,8 +2089,8 @@ private:
20792089
Slot *next;
20802090
size_t hash;
20812091
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;
20842094

20852095
// Stop creating built-in opAssign
20862096
@disable void opAssign(Slot);
@@ -2229,7 +2239,7 @@ public:
22292239

22302240
@property ref Value front()
22312241
{
2232-
return state.front.value;
2242+
return *cast(Value*)&state.front.value;
22332243
}
22342244

22352245
alias state this;

0 commit comments

Comments
 (0)