diff --git a/src/dmd/cparse.d b/src/dmd/cparse.d index 8d3f3b33ead5..2bb269add33c 100644 --- a/src/dmd/cparse.d +++ b/src/dmd/cparse.d @@ -1550,26 +1550,18 @@ final class CParser(AST) : Parser!AST case TOK.semicolon: case TOK.asm_: case TOK.__attribute__: - /* This is a data definition, there cannot now be a - * function definition. - */ - first = false; if (token.value == TOK.asm_) asmname = cparseSimpleAsmExpr(); if (token.value == TOK.__attribute__) { cparseGnuAttributes(specifier); if (token.value == TOK.leftCurly) - { - error("attributes should be specified before the function definition"); - auto t = &token; - if (skipBraces(t)) - { - token = *t; - return; - } - } + break; // function definition } + /* This is a data definition, there cannot now be a + * function definition. + */ + first = false; break; default: diff --git a/test/fail_compilation/failcstuff1.c b/test/fail_compilation/failcstuff1.c index f97b4db68947..4fc884ffeb4d 100644 --- a/test/fail_compilation/failcstuff1.c +++ b/test/fail_compilation/failcstuff1.c @@ -1,7 +1,6 @@ // check the expression parser /* TEST_OUTPUT --- -fail_compilation/failcstuff1.c(51): Error: attributes should be specified before the function definition fail_compilation/failcstuff1.c(100): Error: no members for `enum E21962` fail_compilation/failcstuff1.c(101): Error: no members for anonymous enum fail_compilation/failcstuff1.c(152): Error: `;` or `,` expected