Bug 5867 – Cannot put function attributes (const, pure, ...) on the right of an auto-return function
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-04-20T12:02:00Z
Last change time
2011-05-06T01:59:06Z
Keywords
rejects-valid
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-04-20T12:02:05Z
Test case:
-------------------------
auto f() pure {
return 4;
}
void main() {
assert(f() == 4);
}
-------------------------
As of 2.052 it raises the errors
x.d(1): function declaration without return type. (Note that constructors are always named 'this')
x.d(1): no identifier for declarator pure f()
The error will not happen if the attribute 'pure' is put at the front (pure auto f() { ... }) or the exact return type is provided (int f() pure { ... }).
Possibly the same issue as bug 4785.
Comment #1 by kennytm — 2011-05-06T01:59:06Z
*** This issue has been marked as a duplicate of issue 4865 ***