| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail163.d(11): Error: cannot implicitly convert expression `q` of type `const(char)[]` to `char[]` |
| 5 |
--- |
| 6 |
*/ |
| 7 |
void test1() |
| 8 |
{ |
| 9 |
char[] p; |
| 10 |
const(char)[] q; |
| 11 |
p = q; |
| 12 |
} |
| 13 |
|
| 14 |
/* |
| 15 |
TEST_OUTPUT: |
| 16 |
--- |
| 17 |
fail_compilation/fail163.d(24): Error: cannot implicitly convert expression `p` of type `const(int***)` to `const(int)***` |
| 18 |
--- |
| 19 |
*/ |
| 20 |
void test2() |
| 21 |
{ |
| 22 |
const int*** p; |
| 23 |
const(int)*** cp; |
| 24 |
cp = p; |
| 25 |
} |
| 26 |
|
| 27 |
/* |
| 28 |
TEST_OUTPUT: |
| 29 |
--- |
| 30 |
fail_compilation/fail163.d(37): Error: cannot modify `const` expression `p` |
| 31 |
--- |
| 32 |
*/ |
| 33 |
void test3() |
| 34 |
{ |
| 35 |
const(uint***) p; |
| 36 |
const(int)*** cp; |
| 37 |
p = cp; |
| 38 |
} |
| 39 |
|
| 40 |
/* |
| 41 |
TEST_OUTPUT: |
| 42 |
--- |
| 43 |
fail_compilation/fail163.d(50): Error: cannot implicitly convert expression `cp` of type `const(int)***[]` to `const(uint***)[]` |
| 44 |
--- |
| 45 |
*/ |
| 46 |
void test4() |
| 47 |
{ |
| 48 |
const(uint***)[] p; |
| 49 |
const(int)***[] cp; |
| 50 |
p = cp; |
| 51 |
} |
| 52 |
|
| 53 |
/* |
| 54 |
TEST_OUTPUT: |
| 55 |
--- |
| 56 |
fail_compilation/fail163.d(63): Error: cannot modify `const` expression `*p` |
| 57 |
--- |
| 58 |
*/ |
| 59 |
void test5() |
| 60 |
{ |
| 61 |
int x; |
| 62 |
const(int)* p = &x; |
| 63 |
*p = 3; |
| 64 |
} |
| 65 |
|
| 66 |
/* |
| 67 |
TEST_OUTPUT: |
| 68 |
--- |
| 69 |
fail_compilation/fail163.d(76): Error: cannot implicitly convert expression `& x` of type `int*` to `immutable(int)*` |
| 70 |
fail_compilation/fail163.d(77): Error: cannot modify `immutable` expression `*p` |
| 71 |
--- |
| 72 |
*/ |
| 73 |
void test6() |
| 74 |
{ |
| 75 |
int x; |
| 76 |
immutable(int)* p = &x; |
| 77 |
*p = 3; |
| 78 |
} |
| 79 |
|
| 80 |
/* |
| 81 |
TEST_OUTPUT: |
| 82 |
--- |
| 83 |
fail_compilation/fail163.d(89): Error: cannot implicitly convert expression `& x` of type `const(int)*` to `int*` |
| 84 |
--- |
| 85 |
*/ |
| 86 |
void test7() |
| 87 |
{ |
| 88 |
const(int) x = 3; |
| 89 |
int* p = &x; |
| 90 |
} |