D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6623 - Position rigidity of @system for delegates
Summary: Position rigidity of @system for delegates
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-08 04:32 UTC by bearophile_hugs
Modified: 2024-06-26 11:19 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-09-08 04:32:44 UTC
void main() {
    auto f1 = cast(int delegate(int) @system)(int x){ return 0; }; // OK
    auto f2 = cast(@system int delegate(int))(int x){ return 0; }; // Error
}


DMD 2.055:

test.d(3): basic type expected, not @
test.d(3): found '@' when expecting ')'
test.d(3): semicolon expected following auto declaration, not 'int'
test.d(3): no identifier for declarator int delegate(int)
test.d(3): semicolon expected, not ')'
test.d(3): found ')' instead of statement
test.d(4): unrecognized declaration
Comment 1 Nick Treleaven 2024-06-26 11:19:57 UTC
The attribute position is clearly defined:
https://dlang.org/spec/type.html#TypeSuffix

I don't think we need to complicate parsing by allowing leading attributes. If we did we would have to change function literal parsing too.