Showing with 35 additions and 0 deletions.
  1. +2 −0 src/cast.c
  2. +33 −0 test/runnable/xtest46.d
2 changes: 2 additions & 0 deletions src/cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,8 @@ MATCH implicitConvTo(Expression *e, Type *t)
for (size_t i = 0; i < e->arguments->dim; ++i)
{
Expression *earg = (*e->arguments)[i];
if (!earg) // Bugzilla 14853: if it's on overlapped field
continue;
Type *targ = earg->type->toBasetype();
#if LOG
printf("[%d] earg: %s, targ: %s\n", (int)i, earg->toChars(), targ->toChars());
Expand Down
33 changes: 33 additions & 0 deletions test/runnable/xtest46.d
Original file line number Diff line number Diff line change
Expand Up @@ -7483,6 +7483,39 @@ class Outer14552
class Inner {}
}

/***************************************************/
// 14853

struct Queue14853(T)
{
struct Node
{
T mfPayload = T.init;
union
{
typeof(this)* mfPrev;
shared(typeof(this)*) mfShPrev;
}
union
{
typeof(this)* mfNext;
shared(typeof(this)*) mfShNext;
}
}

Node root;

void pfPut(T v, Node* r = null)
{
shared n = new Node(v); // problem!
}
}

void test14853()
{
auto b1 = new Queue14853!uint;
}

/***************************************************/

int main()
Expand Down