Thread overview
[Issue 5959] New: Return by reference with nested function should be allowed
May 08, 2011
Kenji Hara
Jun 05, 2011
Walter Bright
Jun 07, 2011
yebblies
Sep 24, 2011
Kenji Hara
May 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5959

           Summary: Return by reference with nested function should be
                    allowed
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-05-08 12:06:04 PDT ---
Define nested ref function is not allowed with current dmd, but should be.
----
int n;
void main()
{
    ref int f(){ return n; }            // NG
//  nothrow ref int f(){ return n; }    // OK
//  auto ref int f(){ return n; }       // OK
    f() = 1;
    assert(n == 1);
----

See parse.c, calling route parseDeclDefs -> parseDeclaration changed with dmd 2.020(Fixing issue 2345), but did not changed parseStatement -> parseDeclaration from git brame.

It seems to me that this is a parser problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5959


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2011-06-04 23:52:40 PDT ---
https://github.com/D-Programming-Language/dmd/commit/508ef9681683bad67e4b8516945b974f3716a56b

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5959


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |resume755@mail.ru


--- Comment #2 from yebblies <yebblies@gmail.com> 2011-06-06 21:28:24 PDT ---
*** Issue 2509 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5959


Kenji Hara <k.hara.pg@gmail.com> changed:

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


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-09-24 05:36:01 PDT ---
Already fixed, but not marked.

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