Bug 6202 – Inferring function return type with attributes on both sides of signature
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-06-23T13:18:00Z
Last change time
2011-06-23T13:21:00Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bugzilla
Comments
Comment #0 by bugzilla — 2011-06-23T13:18:39Z
Test case:
@property foo() pure { return 1; }
Error:
a.d(1): function declaration without return type.
(Note that constructors are always named 'this')
a.d(1): no identifier for declarator pure foo()
Both '@property' and 'pure' can be exchanged for any of @safe, nothrow, const, etc. -- the point is that one attribute comes before the function signature and the other comes after.
If 'pure' is removed, the return type is successfully inferred to be int.