Showing with 21 additions and 1 deletion.
  1. +12 −1 src/parse.c
  2. +9 −0 test/compilable/compile1.d
13 changes: 12 additions & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,18 @@ Dsymbols *Parser::parseDeclDefs(int once, Dsymbol **pLastDecl, PrefixAttributes
check(TOKrparen); // pragma(identifier)

Dsymbols *a2 = NULL;
if (token.value != TOKsemicolon)
if (token.value == TOKsemicolon)
{
/* Bugzilla 2354: Accept single semicolon as an empty
* DeclarationBlock following attribute.
*
* Attribute DeclarationBlock
* Pragma DeclDef
* ;
*/
nextToken();
}
else
a2 = parseBlock(pLastDecl);
s = new PragmaDeclaration(loc, ident, args, a2);
break;
Expand Down
9 changes: 9 additions & 0 deletions test/compilable/compile1.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ static assert(S1748!int.stringof == "S1748!int");
class C1748(T) {}
static assert(C1748!int.stringof == "C1748!int");

/**************************************************
2354 pragma + single semicolon DeclarationBlock
**************************************************/

version(all)
pragma(msg, "true");
else
pragma(msg, "false");

/**************************************************
2438
**************************************************/
Expand Down