| 1 |
// PERMUTE_ARGS: -fPIC -O -fPIE |
| 2 |
// DISABLED: win32 win64 |
| 3 |
|
| 4 |
extern (C) int printf(const char*, ...); |
| 5 |
|
| 6 |
/***************************************************/ |
| 7 |
|
| 8 |
align(16) struct S41 |
| 9 |
{ |
| 10 |
int[4] a; |
| 11 |
} |
| 12 |
|
| 13 |
shared int x41; |
| 14 |
shared S41 s41; |
| 15 |
|
| 16 |
void test11310() |
| 17 |
{ |
| 18 |
printf("&x = %p\n", &x41); |
| 19 |
printf("&s = %p\n", &s41); |
| 20 |
assert((cast(int)&s41 & 0xF) == 0); |
| 21 |
} |
| 22 |
|
| 23 |
/***************************************************/ |
| 24 |
|
| 25 |
|
| 26 |
struct S17034 |
| 27 |
{ |
| 28 |
@nogc pure nothrow: |
| 29 |
private long v; |
| 30 |
void foo() |
| 31 |
{ |
| 32 |
v >>>= 1; |
| 33 |
if (!v) |
| 34 |
return; |
| 35 |
v >>>= 1; |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
void test17034() |
| 40 |
{ |
| 41 |
auto s = S17034(1L); |
| 42 |
s.foo(); |
| 43 |
assert(s.v == 0); |
| 44 |
} |
| 45 |
|
| 46 |
/***************************************************/ |
| 47 |
|
| 48 |
// https://issues.dlang.org/show_bug.cgi?id=20441 |
| 49 |
|
| 50 |
const(char)* moo(const (char) *s) |
| 51 |
{ |
| 52 |
return s; |
| 53 |
} |
| 54 |
|
| 55 |
void test20441() |
| 56 |
{ |
| 57 |
const(char) *x = "abc".ptr; |
| 58 |
assert( moo(x) - x == 0 ); |
| 59 |
} |
| 60 |
|
| 61 |
/***************************************************/ |
| 62 |
|
| 63 |
int main() |
| 64 |
{ |
| 65 |
test11310(); |
| 66 |
test17034(); |
| 67 |
test20441(); |
| 68 |
|
| 69 |
printf("Success\n"); |
| 70 |
return 0; |
| 71 |
} |