Skip to content

Commit

Permalink
Merge pull request #1966 from klickverbot/test23-fix
Browse files Browse the repository at this point in the history
Remove undefined behavior from test23.
  • Loading branch information
yebblies committed May 7, 2013
2 parents c3d0c0d + 059cf14 commit 11c01fe
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions test/runnable/test23.d
Expand Up @@ -1336,28 +1336,8 @@ void test64()

void test65()
{
int i;
char[1] c = ['0'];
i = c[0]; // ok
i = *cast(int*)c; // ok
assert((i & 0xFF) == 0x30);

i = *cast(int*)['0']; // compiler seg-fault
assert((i & 0xFF) == 0x30);

if (0)
i = *cast(int*)cast(char[0])[]; // compiler seg-fault
i = *cast(int*)cast(char[1])['0']; // compiler seg-fault
i = *cast(int*)cast(char[1])"0"; // ok

// i = *cast(int*)cast(char[3])['0']; // ok
// i = *cast(int*)cast(char[3])['0', '0']; // ok
i = *cast(int*)cast(char[3])['0', '0', '0']; // compiler seg-fault

// i = *cast(int*)cast(char[4])['0', '0', '0']; // ok
i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault

i = *cast(int*)cast(char[])['0','0','0']; // ok
// Bugzilla Issue 407.
int i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault
printf("i = %x\n", i);
}

Expand Down

0 comments on commit 11c01fe

Please sign in to comment.