www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2808] New: 'nothrow' nested functions cannot be parsed

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


-- 
Apr 06 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2808


clugdbug yahoo.com.au changed:

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





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:


-- 
Apr 06 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2808






It needs a TOKpure added as well.


-- 
Apr 10 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2808







 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. --
Apr 12 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2808


clugdbug yahoo.com.au changed:

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





Fixed DMD2.029


-- 
May 07 2009