Skip to content

Commit

Permalink
fix Issue 14463 - [REG2.067] DMD crashes compiling module level immut…
Browse files Browse the repository at this point in the history
…able struct that takes an array in ctor
  • Loading branch information
9rnsr committed Apr 22, 2015
1 parent ee25709 commit 20f0f7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/interpret.c
Expand Up @@ -4176,9 +4176,9 @@ class Interpreter : public Visitor
newelem = paintTypeOntoLiteral(elemtype, newelem);
if (needsPostblit)
{
newelem = evaluatePostblit(istate, newelem);
if (exceptionOrCantInterpret(newelem))
return newelem;
Expression *x = evaluatePostblit(istate, newelem);
if (exceptionOrCantInterpret(x))
return x;
}
(*oldelems)[(size_t)(j + firstIndex)] = newelem;
}
Expand Down
14 changes: 14 additions & 0 deletions test/compilable/interpret3.d
Expand Up @@ -7378,6 +7378,20 @@ static assert(
return 1;
}());

/**************************************************
14463 - ICE on slice assignment without postblit
**************************************************/

struct Boo14463
{
private int[1] c;
this(int[] x)
{
c = x;
}
}
immutable Boo14463 a14463 = Boo14463([1]);

/**************************************************
13295 - Don't copy struct literal in VarExp::interpret()
**************************************************/
Expand Down

0 comments on commit 20f0f7c

Please sign in to comment.