| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/ccast.d(12): Error: C style cast illegal, use `cast(byte)i` |
| 5 |
fail_compilation/ccast.d(25): Error: C style cast illegal, use `cast(foo)5` |
| 6 |
fail_compilation/ccast.d(27): Error: C style cast illegal, use `cast(void*)5` |
| 7 |
fail_compilation/ccast.d(30): Error: C style cast illegal, use `cast(void*)5` |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
int i; |
| 12 |
byte b = (byte)i; |
| 13 |
|
| 14 |
void bar(int x); |
| 15 |
|
| 16 |
void main() |
| 17 |
{ |
| 18 |
(&bar)(5); // ok |
| 19 |
auto foo = &bar; |
| 20 |
(foo = foo)(5); // ok |
| 21 |
(*foo)(5); // ok |
| 22 |
|
| 23 |
(foo)(5); // ok |
| 24 |
(bar)(5); // ok |
| 25 |
(foo)5; |
| 26 |
|
| 27 |
(void*)5; |
| 28 |
(void*)(5); // semantic implicit cast error |
| 29 |
|
| 30 |
(void*) |
| 31 |
5; |
| 32 |
} |