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