Thread overview
[Issue 2808] New: 'nothrow' nested functions cannot be parsed
Apr 06, 2009
d-bugmail
Apr 06, 2009
d-bugmail
Apr 11, 2009
d-bugmail
Apr 13, 2009
d-bugmail
May 07, 2009
d-bugmail
April 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2808

           Summary: 'nothrow' nested functions cannot be parsed
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: clugdbug@yahoo.com.au


nothrow void foo(){
   void bar1() nothrow {} // ok
   nothrow void bar2() {} // fails
   bar1();
}
---
bug.d(3): found 'nothrow' instead of statement
bug.d(4): no identifier for declarator bar1
bug.d(5): unrecognized declaration


-- 

April 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2808


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch




------- Comment #1 from clugdbug@yahoo.com.au  2009-04-06 14:06 -------
I can make this work by changing parse.c line 3200. It surprises me that this is in Parser::parseStatement; but since it's in the label "Ldeclaration", I believe it is correct. It means that code like "nothrow int x=7;" is accepted, but that's accepted at global scope already. So I don't think there's anything wrong with this patch.


#if DMDV2
        case TOKimmutable:
        case TOKshared:
        case TOKnothrow:   // add this line
#endif
//      case TOKtypeof:
        Ldeclaration:


-- 

April 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2808





------- Comment #2 from bugzilla@digitalmars.com  2009-04-11 00:12 -------
It needs a TOKpure added as well.


-- 

April 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2808





------- Comment #3 from clugdbug@yahoo.com.au  2009-04-12 23:19 -------
 (In reply to comment #2)
> It needs a TOKpure added as well.

I'm not sure that you want to allow 'pure' on nested functions at all, because of bug 2807. If it is allowed, a pure nested function needs to treat all of the variables in the parent function as if they were globals.


-- 

May 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2808


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from clugdbug@yahoo.com.au  2009-05-07 03:04 -------
Fixed DMD2.029


--