Thread overview
[Issue 7743] New: Parsing problem with nothrow delegate
Mar 21, 2012
timon.gehr@gmx.ch
Mar 24, 2012
Kenji Hara
Mar 25, 2012
Walter Bright
March 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7743

           Summary: Parsing problem with nothrow delegate
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-03-20 19:53:27 PDT ---
This code compiles with no errors:

auto foo() {
    int x;
    return delegate() nothrow {
        return x;
    };
}
void main() {}



But with this version:

auto foo() {
    int x;
    return () nothrow {
        return x;
    };
}
void main() {}


DMD 2.059head gives:

test.d(3): expression expected, not ')'
test.d(3): found 'nothrow' when expecting ')'
test.d(3): found '{' when expecting ';' following return statement
test.d(6): unrecognized declaration


Maybe similar issues happens with other annotations.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7743


timon.gehr@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr@gmx.ch


--- Comment #1 from timon.gehr@gmx.ch 2012-03-21 13:41:04 PDT ---
The grammar on dlang.org indicates that it should work.

FunctionLiteral:
    function Typeopt ParameterAttributes opt FunctionBody
    delegate Typeopt ParameterAttributes opt FunctionBody
    ParameterAttributes FunctionBody <<<
    FunctionBody

ParameterAttributes:
    Parameters
    Parameters FunctionAttributes <<<

FunctionAttribute:
    nothrow <<<
    pure
    Property

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-24 00:43:53 PDT ---
https://github.com/D-Programming-Language/dmd/pull/831

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7743



--- Comment #3 from github-bugzilla@puremagic.com 2012-03-24 22:27:49 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d2183ba7aab0d62b91ac230e8a532e9a14699c2f Merge pull request #831 from 9rnsr/fix7743

Issue 7743 - Parsing problem with nothrow delegate

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7743


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: -------