www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4024] New: Last catch only accepts block statement

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: biozic free.fr


--- Comment #0 from biozic <biozic 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: -------
Mar 28 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4024



--- Comment #1 from github-bugzilla puremagic.com 2012-05-30 22:49:32 PDT ---
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)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 30 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4024


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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