| 1 |
/* |
| 2 |
REQUIRED_ARGS: -mcpu=native |
| 3 |
PERMUTE_ARGS: -O -inline -release |
| 4 |
*/ |
| 5 |
|
| 6 |
/*** |
| 7 |
* Do coverage testing of cgelem.d |
| 8 |
* Check coverage here: |
| 9 |
* https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/cgelem.d |
| 10 |
*/ |
| 11 |
|
| 12 |
import core.stdc.stdio; |
| 13 |
|
| 14 |
template tuple(A...) { alias tuple = A; } |
| 15 |
|
| 16 |
/*************************************************/ |
| 17 |
|
| 18 |
void test_eladdr() |
| 19 |
{ |
| 20 |
// & (*p1 = e) => ((*(t = p1) = e), t) |
| 21 |
int i = 4; |
| 22 |
int* p1 = &i; |
| 23 |
int e = 5; |
| 24 |
auto x = &(*p1 = e); |
| 25 |
assert(i == 5); |
| 26 |
assert(x == p1); |
| 27 |
} |
| 28 |
|
| 29 |
/*************************************************/ |
| 30 |
|
| 31 |
void test_elneg() |
| 32 |
{ |
| 33 |
static int i = 3; |
| 34 |
int j = - -i; |
| 35 |
assert(i == j); |
| 36 |
} |
| 37 |
|
| 38 |
/*************************************************/ |
| 39 |
|
| 40 |
int main() |
| 41 |
{ |
| 42 |
test_eladdr(); |
| 43 |
test_elneg(); |
| 44 |
|
| 45 |
printf("Success\n"); |
| 46 |
return 0; |
| 47 |
} |