Bug 4024 – Last catch only accepts block statement

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-03-28T08:56:00Z
Last change time
2014-02-15T02:46:38Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
biozic

Comments

Comment #0 by biozic — 2010-03-28T08:56:17Z
void main() { try int i; catch (Exception e) int j; catch { int k; } try int i; catch (Exception e) int j; catch int k; // ERROR:: compiler expects ( } A NoScopeNonEmptyStatement is expected after the last catch. Maybe this patch can help solve the problem. =================================================================== --- parse.c (revision 422) +++ parse.c (working copy) @@ -4064,11 +4064,11 @@ Statement *Parser::parseStatement(int fl Type *t; Identifier *id; Loc loc = this->loc; nextToken(); - if (token.value == TOKlcurly) + if (token.value == TOKlcurly || token.value != TOKlparen) { t = NULL; id = NULL; } else
Comment #1 by github-bugzilla — 2012-05-30T22:49:32Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/17b73a6022b0185dfde932cbe33da1741e7de963 Fix parsing of catch statement with no type (bug #4024) https://github.com/D-Programming-Language/dmd/commit/07af203c9c38022086aa059a11f5934484fee6d7 Merge pull request #970 from biozic/last-catch Fix parsing of catch statement with no type (bug #4024)