view gcc/testsuite/gdc.test/fail_compilation/parseStc.d @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

/*
TEST_OUTPUT:
---
fail_compilation/parseStc.d(11): Error: found `;` when expecting `)`
fail_compilation/parseStc.d(11): Error: found `)` when expecting `;` following statement
fail_compilation/parseStc.d(12): Error: redundant attribute `const`
---
*/
void test1()
{
    if (x; 1) {}
    if (const const auto x = 1) {}
}

/*
TEST_OUTPUT:
---
fail_compilation/parseStc.d(25): Error: redundant attribute `const`
fail_compilation/parseStc.d(26): Error: redundant attribute `const`
fail_compilation/parseStc.d(27): Error: conflicting attribute `immutable`
---
*/
void test2()
{
    const const x = 1;
    foreach (const const x; [1,2,3]) {}
    foreach (const immutable x; [1,2,3]) {}
}

/*
TEST_OUTPUT:
---
fail_compilation/parseStc.d(37): Error: redundant attribute `const`
fail_compilation/parseStc.d(38): Error: redundant attribute `const`
---
*/
struct S3 { const const test3() {} }
void test4(const const int x) {}