[Issue 4024] New: Last catch only accepts block statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 28 08:56:19 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4024

           Summary: Last catch only accepts block statement
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: biozic at free.fr


--- Comment #0 from biozic <biozic at free.fr> 2010-03-28 08:56:17 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list