Skip to content

Commit

Permalink
Test cases for 6123 and CTFE pointer +=
Browse files Browse the repository at this point in the history
  • Loading branch information
Don Clugston committed Jun 9, 2011
1 parent 4c6d0d1 commit 9c9a697
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion test/compilable/interpret3.d
Expand Up @@ -1334,7 +1334,7 @@ static const S6100[2] s6100a = [ init6100(1), init6100(2) ];
static assert(s6100a[0].a == 1);

/**************************************************
Bug 6120
Bug 6120 -- failed with -inline
**************************************************/

struct Bug6120(T) {
Expand All @@ -1345,6 +1345,20 @@ static assert({
return true;
}());

/**************************************************
Bug 6123 -- failed with -inline
**************************************************/

struct Bug6123(T) {
void f() {}
// can also trigger if the struct is normal but f is template
}
static assert({
auto piece = Bug6123!int();
piece.f();
return true;
}());

/**************************************************
Bug 6053 -- ICE involving pointers
**************************************************/
Expand Down Expand Up @@ -1521,3 +1535,24 @@ static assert( is(typeof(compiles!(ptrDeref(5, false)))));
static assert(!is(typeof(compiles!(ptrDeref(5, true)))));
static assert(!is(typeof(compiles!(ptrDeref(6, false)))));
static assert(!is(typeof(compiles!(ptrDeref(6, true)))));

/**************************************************
Pointer +=
**************************************************/
static assert({
int [12] x;
int zzz;
assert(&zzz);
int *p = &x[10];
int *q = &x[4];
q = p;
assert(p == q);
q = &x[4];
assert(p != q);
q += 4;
assert(q == &x[8]);
q = q - 2;
q = q + 4;
assert(q is p);
return 6;
}() == 6);

0 comments on commit 9c9a697

Please sign in to comment.