Bug 7743 – Parsing problem with nothrow delegate

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-20T19:53:00Z
Last change time
2012-03-24T23:35:08Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-03-20T19:53:27Z
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.
Comment #1 by timon.gehr — 2012-03-21T13:41:04Z
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
Comment #2 by k.hara.pg — 2012-03-24T00:43:53Z
Comment #3 by github-bugzilla — 2012-03-24T22:27:49Z
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