Skip to content

Commit

Permalink
Issue 6868 - IsExp + incorrect static array type = error
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Nov 15, 2011
1 parent 445f0cf commit eea7da7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mtype.c
Expand Up @@ -3498,7 +3498,10 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)
if (dim)
{ dinteger_t n, n2;

int errors = global.errors;
dim = semanticLength(sc, tbn, dim);
if (errors != global.errors)
goto Lerror;

dim = dim->optimize(WANTvalue);
if (sc && sc->parameterSpecialization && dim->op == TOKvar &&
Expand Down
18 changes: 18 additions & 0 deletions test/runnable/xtest46.d
Expand Up @@ -4101,6 +4101,23 @@ static void breaksPure5311b(S5311 x) pure
static assert(!__traits(compiles, { int a = x.globalData; }));
}

/***************************************************/
// 6868

@property bool empty6868(T)(in T[] a) @safe pure nothrow
{
return !a.length;
}

void test6868()
{
alias int[] Range;
static if (is(char[1 + Range.empty6868])) // Line 9
enum bool isInfinite = true;

char[0] s; // need
}

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

int main()
Expand Down Expand Up @@ -4298,6 +4315,7 @@ int main()
test6910();
test6902();
test6330();
test6868();

printf("Success\n");
return 0;
Expand Down

0 comments on commit eea7da7

Please sign in to comment.