Bug 6623 – Position rigidity of @system for delegates

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-08T04:32:44Z
Last change time
2024-06-26T11:19:57Z
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-09-08T04:32:44Z
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 by nick — 2024-06-26T11:19:57Z
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.