Skip to content

Commit

Permalink
Merge pull request #3780 from 9rnsr/fix13141
Browse files Browse the repository at this point in the history
[REG2.066a] Issue 13141 - array cast from string[] to immutable(char[][]) is not supported at compile time
  • Loading branch information
WalterBright authored and 9rnsr committed Jul 17, 2014
1 parent d486765 commit cad191c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cast.c
Expand Up @@ -749,6 +749,8 @@ MATCH implicitConvTo(Expression *e, Type *t)
if (e->f && e->f->isolateReturn())
{
result = e->type->immutableOf()->implicitConvTo(t);
if (result > MATCHconst) // Match level is MATCHconst at best.
result = MATCHconst;
return;
}

Expand Down
22 changes: 22 additions & 0 deletions test/compilable/interpret3.d
Expand Up @@ -4259,6 +4259,28 @@ void ice10610()
static assert (T10610.min.baz());
}

/**************************************************
13141 regression fix caused by 10610
**************************************************/

struct MapResult13141(alias pred)
{
int[] range;
@property empty() { return range.length == 0; }
@property front() { return pred(range[0]); }
void popFront() { range = range[1..$]; }
}

string[] array13141(R)(R r)
{
typeof(return) result;
foreach (e; r)
result ~= e;
return result;
}

//immutable string[] splitterNames = [4].map!(e => "4").array();
immutable string[] splitterNames13141 = MapResult13141!(e => "4")([4]).array13141();

/**************************************************
11587 AA compare
Expand Down

0 comments on commit cad191c

Please sign in to comment.