Skip to content

Commit

Permalink
fix Issue 8889 - [2.061 beta][64-bit] Assertion Failure argtypes.c
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Oct 25, 2012
1 parent 2c09f6f commit 61b5435
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 35 deletions.
2 changes: 2 additions & 0 deletions src/argtypes.c
Expand Up @@ -370,6 +370,8 @@ TypeTuple *TypeStruct::toArgTypes()
unsigned off2 = f->offset;
if (ft1)
off2 = 8;
if (!t2 && off2 != 8)
goto Lmemory;
assert(t2 || off2 == 8);
t2 = argtypemerge(t2, ft2, off2 - 8);
if (!t2)
Expand Down
70 changes: 35 additions & 35 deletions test/compilable/aliasdecl.d
@@ -1,35 +1,35 @@
template Test(T){ alias Type = T; }

alias X1 = int;
static assert(is(X1 == int));

alias X2 = immutable(long)[], X3 = shared const double[int];
static assert(is(X2 == immutable(long)[]));
static assert(is(X3 == shared const double[int]));

alias X4 = void delegate() const, X5 = Test!int;
static assert(is(X4 == void delegate() const));
static assert(is(X5.Type == int));

void main()
{
alias Y1 = int;
static assert(is(Y1 == int));

alias Y2 = immutable(long)[], Y3 = shared const double[int];
static assert(is(Y2 == immutable(long)[]));
static assert(is(Y3 == shared const double[int]));

alias Y4 = void delegate() const, Y5 = Test!int;
static assert(is(Y4 == void delegate() const));
static assert(is(Y5.Type == int));

struct S
{
int value;
alias this = value;
}
auto s = S(10);
int n = s;
assert(n == 10);
}
template Test(T){ alias Type = T; }

alias X1 = int;
static assert(is(X1 == int));

alias X2 = immutable(long)[], X3 = shared const double[int];
static assert(is(X2 == immutable(long)[]));
static assert(is(X3 == shared const double[int]));

alias X4 = void delegate() const, X5 = Test!int;
static assert(is(X4 == void delegate() const));
static assert(is(X5.Type == int));

void main()
{
alias Y1 = int;
static assert(is(Y1 == int));

alias Y2 = immutable(long)[], Y3 = shared const double[int];
static assert(is(Y2 == immutable(long)[]));
static assert(is(Y3 == shared const double[int]));

alias Y4 = void delegate() const, Y5 = Test!int;
static assert(is(Y4 == void delegate() const));
static assert(is(Y5.Type == int));

struct S
{
int value;
alias this = value;
}
auto s = S(10);
int n = s;
assert(n == 10);
}
13 changes: 13 additions & 0 deletions test/runnable/test42.d
Expand Up @@ -5254,6 +5254,18 @@ void test8840()

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

struct S8889
{
real f;
int i;
}

void test8889()
{
}

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

int main()
{
test1();
Expand Down Expand Up @@ -5518,6 +5530,7 @@ int main()
test8423();
test8496();
test8840();
test8889();

writefln("Success");
return 0;
Expand Down

0 comments on commit 61b5435

Please sign in to comment.