www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7743] New: Parsing problem with nothrow delegate

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



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: -------
Mar 20 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7743


timon.gehr gmx.ch changed:

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



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: -------
Mar 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Mar 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7743




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d2183ba7aab0d62b91ac230e8a532e9a14699c2f


Issue 7743 - Parsing problem with nothrow delegate

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 24 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Mar 24 2012