| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/parseStc.d(12): Error: missing closing `)` after `if (x` |
| 5 |
fail_compilation/parseStc.d(12): Error: use `{ }` for an empty statement, not `;` |
| 6 |
fail_compilation/parseStc.d(12): Error: found `)` when expecting `;` following expression |
| 7 |
fail_compilation/parseStc.d(12): expression: `1` |
| 8 |
fail_compilation/parseStc.d(13): Error: redundant attribute `const` |
| 9 |
--- |
| 10 |
*/ |
| 11 |
void test1() { |
| 12 |
if (x; 1) {} |
| 13 |
if (const const auto x = 1) {} |
| 14 |
} |
| 15 |
|
| 16 |
/* |
| 17 |
TEST_OUTPUT: |
| 18 |
--- |
| 19 |
fail_compilation/parseStc.d(26): Error: redundant attribute `const` |
| 20 |
fail_compilation/parseStc.d(27): Error: redundant attribute `const` |
| 21 |
fail_compilation/parseStc.d(28): Error: conflicting attribute `immutable` |
| 22 |
--- |
| 23 |
*/ |
| 24 |
void test2() |
| 25 |
{ |
| 26 |
const const x = 1; |
| 27 |
foreach (const const x; [1,2,3]) {} |
| 28 |
foreach (const immutable x; [1,2,3]) {} |
| 29 |
} |
| 30 |
|
| 31 |
/* |
| 32 |
TEST_OUTPUT: |
| 33 |
--- |
| 34 |
fail_compilation/parseStc.d(38): Error: redundant attribute `const` |
| 35 |
fail_compilation/parseStc.d(39): Error: redundant attribute `const` |
| 36 |
--- |
| 37 |
*/ |
| 38 |
struct S3 { const const test3() {} } |
| 39 |
void test4(const const int x) {} |